Sign in to follow this  

menu not appearing

This topic is 4022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently making a map editor with C++/ win32 and my menu isnt appearing. I'm not sure exactly what the problem is but i think it may have something to do with this; Menu = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_MENU)); SetMenu (Window, Menu); PopupMenu = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_POPUP_MENU)); Pretty much I have a menu which is supposed ot sit at the top like in most applications but it doesnt appear and a popup menu that appears when you right click somewhere on the window. The code compiles fine but I dont know why the menu doesnt show...

Share this post


Link to post
Share on other sites
According to MSDN, SetMenu() should cause the Window to be redrawn to reflect the change, so that should work.

Are you testing the returns from LoadMenu() and SetMenu()? If you call SetMenu(Hw,NULL), it removes the current menu, so if LoadMenu() is returning NULL, that would explain why it isn't working.

Just a thought.


Menu = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_MENU));

if(Menu==NULL) MessageBox(Window,"Here's the problem","",MB_OK);

SetMenu (Window, Menu);

Share this post


Link to post
Share on other sites
Without more info, all I can suggest is:

a) Post your resource file (.rc). Perhaps there is an error in there.
b) Are you sure the resource file (.rc) is being compiled into the .res file?
c) Are you sure the .res file is being linked to the exe? What compiler/IDE are you using?

Share this post


Link to post
Share on other sites
okay heres my resource script;

#include "resource.hpp"

IDR_MENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Drawing"
BEGIN
MENUITEM "&Wireframe", ID_DRAWING_WIREFRAME
, CHECKED
MENUITEM "&Solid", ID_DRAWING_SOLID
END
END

IDR_POPUP_MENU MENU DISCARDABLE
BEGIN
POPUP "popup"
BEGIN
MENUITEM "Move", ID_POPUP_MOVE
MENUITEM SEPARATOR
MENUITEM "Duplicate", ID_POPUP_DUPLICATE
MENUITEM "Delete", ID_POPUP_DELETE
MENUITEM SEPARATOR
MENUITEM "Texture", ID_POPUP_TEXTURE
END
END

also I'm using the devC++ IDE

[Edited by - namingway on December 12, 2006 6:45:08 PM]

Share this post


Link to post
Share on other sites
Looks fine to me. My guess is that the resource compiler isn't being invoked correctly or the .res file isn't being linked to your application. The only other possibility I can think of is that your hInstance is invalid, but that doesn't seem very likely.

I'm not familiar with DevC++, but I'm sure someone else here will know how to compile and link Windows resources with it.

If all else fails, you could always download Visual C++ Express. Compiling and linking resources is very easy with that.

Sorry I can't be of more help.

Share this post


Link to post
Share on other sites

This topic is 4022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this