Adding a pop-up menu to a window.

Started by
8 comments, last by Conqueran 18 years, 4 months ago
I've been trying to add a pop-up menu to a window in C++ windows programming for several days now. I know I'm suppose to add the event in WM_CONTEXTMENU however I don't know what to add... I read the help files but they dont help at all. Does anyone have sample code or suggestions so I can get through this? Thank You very much :).
Advertisement
Are you using the raw Win32 API or are you using a wrapper like MFC?
Check http://www.falloutsoftware.com/tutorials/win/win4.htm
I guess raw win32 API...

I think that link discusses menu's from the top. I'd like to right click anywhere on the screen and have a menu pop up, sort of like when you right click on your desktop you have options like "refresh, paste, properties, etc"
Yes doing that would be no more than a simple extension to the eksample code
Quote:Original post by pulpfist
Yes doing that would be no more than a simple extension to the eksample code


In what way? I'm a total idiot when it comes to these things
Ill see if I find any resources... Ill merge it here if I find some

http://www.winprog.org/tutorial/menus.html

Maybe the contents of the resource.* files stays the same, and you just have to attach the menu to a components handle rather than to the main window.
Im not sure :/


[Edited by - pulpfist on November 27, 2005 6:34:38 PM]
To create the popup menu, you can call CreatePopupMenu(), which returns an HMENU. You can call InsertMenu() and AppendMenu() to populate the popup menu with menu items. Then you can call TrackPopupMenu() to actually show the popup. After you're done with it, call DestroyMenu() release the resources that the menu consumes.
Thanks too everybody for their help! I finally got the hang of it!

I'm very happy I have a board like this to get help from, THANKS AGAIN .
Lol I thought I didn't need any more help...

I've been using InsertMenu to insert different things into my HMENU. However what if I want to insert another HMENU!? like a submenu within a popup menu... Anyone know?

This topic is closed to new replies.

Advertisement