Click here to Skip to main content
15,921,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to compress DICOM image to raw file format? Pin
Member 199230329-May-05 19:43
Member 199230329-May-05 19:43 
GeneralImplementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
shatterstar645725-May-05 12:54
shatterstar645725-May-05 12:54 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
Christian Graus25-May-05 15:56
protectorChristian Graus25-May-05 15:56 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
shatterstar645726-May-05 6:25
shatterstar645726-May-05 6:25 
GeneralRe: Implementing DirectX on Visual Studio.NET 2003 Arc. Enterprise and 2005 Pin
Christian Graus26-May-05 11:43
protectorChristian Graus26-May-05 11:43 
Generalthe S in writelines Pin
anaidu25-May-05 12:50
anaidu25-May-05 12:50 
GeneralRe: the S in writelines Pin
Christian Graus25-May-05 15:58
protectorChristian Graus25-May-05 15:58 
GeneralBinary to ASCII Pin
heng098725-May-05 12:27
heng098725-May-05 12:27 
GeneralRe: Binary to ASCII Pin
Christian Graus25-May-05 15:59
protectorChristian Graus25-May-05 15:59 
GeneralRe: Binary to ASCII Pin
heng098731-May-05 4:40
heng098731-May-05 4:40 
GeneralRe: Binary to ASCII Pin
heng098731-May-05 10:33
heng098731-May-05 10:33 
GeneralGetting it to work in Windows 2000 and Windows XP Pin
droozenrule@yahoo.com25-May-05 11:05
sussdroozenrule@yahoo.com25-May-05 11:05 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
Ravi Bhavnani25-May-05 11:32
professionalRavi Bhavnani25-May-05 11:32 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
Graham Bradshaw25-May-05 12:27
Graham Bradshaw25-May-05 12:27 
GeneralRe: Getting it to work in Windows 2000 and Windows XP Pin
droozenrule@yahoo.com26-May-05 11:22
sussdroozenrule@yahoo.com26-May-05 11:22 
Questionhow to completely remove a menu item during run-time Pin
elephantstar25-May-05 10:31
elephantstar25-May-05 10:31 
Hi there,

I need to delete the Options menu during run-time. Currently it deletes it when the application first starts up. Then as I open up other CMultiDocTemplate windows, it reappears. These are the two functions I have in the CMainFrame class. I called the OnChangeFileMenu() function within the application class in InitInstance(). I thought that would do the trick but somehow it reappears as I open up other modal windows.

void CMainFrame::OnChangeFileMenu()
{
CWnd* pMain = AfxGetMainWnd();

// Get the menu from the application window.
CMenu* mmenu = pMain->GetMenu();

int pos = FindMenuItem(mmenu, "&Options");
if (pos > -1)
mmenu->RemoveMenu(pos, MF_BYPOSITION);

pMain->DrawMenuBar();
}

int CMainFrame::FindMenuItem(CMenu *menu, LPCTSTR menustr)
{
ASSERT(menu);
ASSERT(::IsMenu(menu->GetSafeHmenu()));

int count = menu->GetMenuItemCount();
for (int i = 0; i < count; i++)
{
CString str;
if (menu->GetMenuString(i, str, MF_BYPOSITION) &&
(strcmp(str, menustr) == 0))
return i;
}

return -1;
}

Besides inserting the below code in InitInstance, I also included it in the document view class's OnInitialUpdate:

// Get MDI Frame window
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();

#ifdef MODE_1
pMainFrame->OnChangeFileMenu();
#endif

That did the trick for only one document view class but not others. It does not detect the presence of the menu when it's called yet it reappears afterwards. How can I remove it completely without having to insert the above code in numerous places. It should have taken care of it in InitInstance(). Thanks.
AnswerRe: how to completely remove a menu item during run-time Pin
Iain Clarke, Warrior Programmer26-May-05 1:32
Iain Clarke, Warrior Programmer26-May-05 1:32 
GeneralRe: how to completely remove a menu item during run-time Pin
elephantstar27-May-05 7:15
elephantstar27-May-05 7:15 
GeneralHooking problem - need urgent help Pin
YaronNir25-May-05 8:47
YaronNir25-May-05 8:47 
Questionhow to change window's start button text? problem with my program Pin
ELY M.25-May-05 7:40
ELY M.25-May-05 7:40 
AnswerRe: how to change window's start button text? problem with my program Pin
Ravi Bhavnani25-May-05 8:47
professionalRavi Bhavnani25-May-05 8:47 
AnswerRe: how to change window's start button text? problem with my program Pin
David Crow25-May-05 8:59
David Crow25-May-05 8:59 
GeneralRe: how to change window's start button text? problem with my program Pin
ELY M.25-May-05 9:07
ELY M.25-May-05 9:07 
GeneralRe: how to change window's start button text? problem with my program Pin
David Crow25-May-05 9:11
David Crow25-May-05 9:11 
GeneralRe: how to change window's start button text? problem with my program Pin
ELY M.27-May-05 15:14
ELY M.27-May-05 15:14 

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.