I am having troubles getting my menu to work. I have a menu in my resource file. I am using a dialog box as a main window. The main dialog box calls a second dialog box. I only want my menu to work on the second dialog box.

If I do this:
mov wc.lpszMenuName,IDM_MENU

The menu appears on both dialog boxes. Shazbot!

If I do this:
mov wc.lpszMenuName,0
The menu does not appear on either dialog box. So far so good.

Now if I try this on the second dialog box: (in the WM_INITDIALOG area)
invoke LoadMenu,hInstance,IDM_MENU
invoke SetMenu,hWin,eax

The menu does not appear on the second dialog box where I need it. Can anyone tell me WTF?

I have searched quit a bit and found many references to:
invoke LoadMenu,hInstance,IDM_MENU
invoke SetMenu,hWin,eax

But cant make it work. How I do dis?

Thanks in advance.


Posted on 2006-11-09 22:43:07 by SideSwipe
The lines LoadMenu and SetMenu should work in your case. Are you sure that both hInstance & hWin are having the expected values?

Can you post/attach the code you are using?
Posted on 2006-11-10 06:55:51 by JimmyClif
Hello JimmyClif and All:

I managed to get my menu working by changing the template I was using with RadAsm.

Instead of using dialog as main template that has a WinMain Proc and all of the wc.lpszMenuName,IDM_MENU stuff.

I used the Dialog as App template and now it works with LoadMenu/SetMenu. It was a weird problem, I discovered that not only did the menu not show up on the second dialog box, none of the controls and buttons worked either. It didnt seem to matter which dialog box I invoked first, the controls on the second dialog box would not work. I dunno what I was doing wrong there, took about four hours to get it working again!

Anyway, thanks for your offer of help!

Posted on 2006-11-10 10:25:05 by SideSwipe