Advertisement

how to use CMenu

Started by August 04, 2000 05:35 AM
6 comments, last by remo 24 years, 4 months ago
i have the following code:
    
void CTetrisWindow::CreateMenu ()
{
	//CMenu* old_menu = CMenu::FromHandle(m_hMenuDefault);
	SetMenu(NULL);
	//old_menu->DestroyMenu();

	CMenu m, game, help;
	game.CreatePopupMenu ();
	game.AppendMenu (0, 101, "&New");
	game.AppendMenu (MF_SEPARATOR, 102, "");
	game.AppendMenu (0, 103, "&Quit");
	help.CreatePopupMenu ();
	help.AppendMenu (0, 151, "&Instructions");
	help.AppendMenu (MF_SEPARATOR, 152, "");
	help.AppendMenu (0, 153, "&About");
	m.CreateMenu ();
	m.AppendMenu (MF_POPUP, (UINT) (game.m_hMenu), "Game");
	m.AppendMenu (MF_POPUP, (UINT) (help.m_hMenu), "Help");

	SetMenu(&m);
	//m_hMenuDefault = m.m_hMenu;

}
    
for some reason this doesn''t work, instead of showing the menu, it just shows what was behind the window before it was shown. can someone please tell me how i am supposed to do it before i go insane and place a bomb under the microsoft headquarters?
[email=ehremo@hotmail.com][/email]
OT.. there seems to be something wrong with the [ source ] box. It doesn''t like the string length to be 0 between "". Hmmm.... someone outghto fix that...

-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
Advertisement
yes that isn''t really very helpful, is it?
[email=ehremo@hotmail.com][/email]
theres a lot of things it doesnt like . im surprised this is has gone on so long as it has in flipcode it was fixed within a week, after all this is meant to be a site for programmers!!!

Edited by - zedzeek on August 4, 2000 9:40:37 AM
AAAAARGH
TWO USELESS ANSWERS

anyway my question has changed now

what i have now is

void CTetrisWindow::CreateMenu (){	SetMenu(NULL);	CMenu* pMenu = GetMenu();	if (pMenu) 		pMenu->DestroyMenu();	HMENU hMenu = LoadMenu (g_cApp.m_hInstance, MAKEINTRESOURCE(IDR_MENU));	pMenu = CMenu::FromHandle(hMenu);	SetMenu(pMenu);   m_hMenuDefault = hMenu;} 


and this works better, since it loads the menu and draws it so that all ok... problem is that all the menu items are disabled for some reason...?

someone please help me... and forget the sodding thing about the source syntax colorer
[email=ehremo@hotmail.com][/email]
AAAAARGH
TWO USELESS ANSWERS

anyway my question has changed now

what i have now is

void CTetrisWindow::CreateMenu (){	SetMenu(NULL);	CMenu* pMenu = GetMenu();	if (pMenu) 		pMenu->DestroyMenu();	HMENU hMenu = LoadMenu (g_cApp.m_hInstance, MAKEINTRESOURCE(IDR_MENU));	pMenu = CMenu::FromHandle(hMenu);	SetMenu(pMenu);   m_hMenuDefault = hMenu;} 


and this works better, since it loads the menu and draws it so that all ok... problem is that all the menu items are disabled for some reason...?

someone please help me... and forget the sodding thing about the source syntax colorer
[email=ehremo@hotmail.com][/email]
Advertisement
You need to have handlers for each of the menu IDs. If you don''t have handlers, your menu items are greyed-out. Some kind of resource magic or something.
hmmm please let me know what you are trying to do and i''ll rewrite the code!

This topic is closed to new replies.

Advertisement