Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Region Pin
MemLeak13-May-03 8:51
MemLeak13-May-03 8:51 
GeneralRe: Region Pin
John R. Shaw13-May-03 12:58
John R. Shaw13-May-03 12:58 
GeneralDrag & Drop Pin
Mazdak13-May-03 7:38
Mazdak13-May-03 7:38 
GeneralMS DataGrid Control Pin
Lobster B13-May-03 6:59
Lobster B13-May-03 6:59 
GeneralBest Software For Printing Out Code Pin
Mike O'Neill13-May-03 6:23
Mike O'Neill13-May-03 6:23 
GeneralRe: Best Software For Printing Out Code Pin
Neville Franks13-May-03 7:23
Neville Franks13-May-03 7:23 
GeneralImageList_Read & ImageList_Write functions... Pin
Guy Lecomte13-May-03 5:37
Guy Lecomte13-May-03 5:37 
GeneralCRecentFileList Pin
dings13-May-03 5:28
dings13-May-03 5:28 
Hi,
I have troubles with CRecentFileList.
I want to manage the Recent Files manually if I do an "Open" or a "Save As" in my SDI-Document.
My RecentFileList has the ID "Hi,
I have troubles with CRecentFileList.
I want to manage the Recent Files manually if I do an "Open" or a "Save As" in my SDI-Document.
My RecentFileList has the ID "ID_FILE_MRU_FILE1" in my menu "ID_MAINFRAME".

This is my code, which I call at an "Open" or a "Save As":

void CMainFrame::setMRU(CString File)
{
CRecentFileList* m_pMRU;
m_pMRU = new CRecentFileList( 1, _T("Software\\tsSoft\\nm\\MRU"), _T("File#%d"), 4 );
m_pMRU->ReadList();
char* a = (char*) malloc(File.GetLength()+1);
sprintf(a,"%s",File.GetBuffer(File.GetLength()));
//MessageBox((*m_pMRU)[0]+"Pferd",(*m_pMRU)[0],MB_OK);
//MessageBox((*m_pMRU)[1]+"Pferd",(*m_pMRU)[1],MB_OK);
if( File.GetLength()>0 ) m_pMRU->Add(a);
m_pMRU->WriteList();
// Eintrag suchen und überschreiben
CCmdUI* cmdUI = new CCmdUI();
cmdUI->m_nID = ID_FILE_MRU_FILE1;
cmdUI->m_pMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu( 0);
for( cmdUI->m_nIndex=0; cmdUI->m_nIndex < cmdUI->m_pMenu->GetMenuItemCount(); cmdUI->m_nIndex++) {
if( cmdUI->m_pMenu->GetMenuItemID(cmdUI->m_nIndex)==cmdUI->m_nID) {
m_pMRU->UpdateMenu(cmdUI);
break;
}
}
}

What is the problem with it?
I got 2.

First, I can't see my Files in the registry at "Software\\tsSoft\\nm\\MRU" and I don't know why and second I got an Assertion-Error at "m_pMRU->UpdateMenu(cmdUI);"

It will be very nice, if someone can help me to solve my problem!
Greetings,
Tobias

PS: Excuse my bad english!" in my menu "ID_MAINFRAME".

This is my code, which I call at an "Open" or a "Save As":

void CMainFrame::setMRU(CString File)
{
CRecentFileList* m_pMRU;
m_pMRU = new CRecentFileList( 1, _T("Software\\tsSoft\\nm\\MRU"), _T("File#%d"), 4 );
m_pMRU->ReadList();
char* a = (char*) malloc(File.GetLength()+1);
sprintf(a,"%s",File.GetBuffer(File.GetLength()));
//MessageBox((*m_pMRU)[0]+"Pferd",(*m_pMRU)[0],MB_OK);
//MessageBox((*m_pMRU)[1]+"Pferd",(*m_pMRU)[1],MB_OK);
if( File.GetLength()>0 ) m_pMRU->Add(a);
m_pMRU->WriteList();
// Eintrag suchen und überschreiben
CCmdUI* cmdUI = new CCmdUI();
cmdUI->m_nID = ID_FILE_MRU_FILE1;
cmdUI->m_pMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu( 0);
for( cmdUI->m_nIndex=0; cmdUI->m_nIndex < cmdUI->m_pMenu->GetMenuItemCount(); cmdUI->m_nIndex++) {
if( cmdUI->m_pMenu->GetMenuItemID(cmdUI->m_nIndex)==cmdUI->m_nID) {
m_pMRU->UpdateMenu(cmdUI);
break;
}
}
}

What is the problem with it?
I got 2.

First, I can't see my Files in the registry at "Software\\tsSoft\\nm\\MRU" and I don't know why and second I got an Assertion-Error at "m_pMRU->UpdateMenu(cmdUI);"
How can I make it working right? So that my Recent Files are shown at "ID_FILE_MRU_FILE1" ?

It will be very nice, if someone can help me to solve my problem!
Greetings,
Tobias

PS: Excuse my bad english!
GeneralCRecentFileList Pin
dings13-May-03 5:21
dings13-May-03 5:21 
GeneralOpening folders Pin
dave_long13-May-03 5:13
dave_long13-May-03 5:13 
GeneralRe: Opening folders Pin
valikac13-May-03 7:54
valikac13-May-03 7:54 
GeneralRe: Opening folders Pin
dave_long13-May-03 9:07
dave_long13-May-03 9:07 
GeneralRe: Opening folders Pin
J. Dunlap13-May-03 9:51
J. Dunlap13-May-03 9:51 
GeneralRe: Opening folders Pin
Hari Krishnan (Noida)13-May-03 17:05
Hari Krishnan (Noida)13-May-03 17:05 
GeneralRe: Opening folders Pin
dave_long13-May-03 22:09
dave_long13-May-03 22:09 
GeneralPassing a pointer to an array Pin
Tom Wright13-May-03 5:09
Tom Wright13-May-03 5:09 
GeneralRe: Passing a pointer to an array Pin
Chris Meech13-May-03 5:21
Chris Meech13-May-03 5:21 
GeneralRe: Passing a pointer to an array Pin
Alvaro Mendez13-May-03 6:13
Alvaro Mendez13-May-03 6:13 
GeneralRe: Passing a pointer to an array Pin
Tom Wright13-May-03 8:50
Tom Wright13-May-03 8:50 
GeneralRe: Passing a pointer to an array Pin
Tom Wright13-May-03 8:52
Tom Wright13-May-03 8:52 
GeneralRe: Passing a pointer to an array Pin
David Crow13-May-03 9:35
David Crow13-May-03 9:35 
GeneralRe: Passing a pointer to an array Pin
Renjith Ramachandran13-May-03 7:10
Renjith Ramachandran13-May-03 7:10 
GeneralPS or PDF display/print Pin
Bartosz Bien13-May-03 5:06
Bartosz Bien13-May-03 5:06 
GeneralRe: PS or PDF display/print Pin
imsniper13-May-03 23:38
imsniper13-May-03 23:38 
QuestionHow To Get Pointer to Main Menu in case of MDI Application Pin
Anonymous13-May-03 4:50
Anonymous13-May-03 4:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.