Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / C++ / C# - Win32 API. How do you make a context menu?

Author
Message
coolgames
19
Years of Service
User Offline
Joined: 26th Sep 2005
Location: Oregon, USA
Posted: 1st Aug 2009 09:01
How would I use the win32 api to create a context menu that would appear when the user right clicks within the application?

I've searched for how to create a context menu, but I couldn't find anything. I'm using c++, with the basic windows api.

Thanks,
Coolgames
ShaunRW
DBPro Developer
17
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 4th Aug 2009 04:01 Edited at: 4th Aug 2009 04:12
What you're thinking of are Popup menus.

CreatePopupMenu Function - You would use this to create your menu.

AppendMenu Function - You would use this to add items to your menu.

TrackPopupMenu Function - You would use this to show the Menu and it returns the item that was selected.

And to place the menu at the position of the cursor.

GetCursorPos Function - I Think this is the function that you can use to get the cursor position.

For more function involving menusCheck here.

Hope i helped.


coolgames
19
Years of Service
User Offline
Joined: 26th Sep 2005
Location: Oregon, USA
Posted: 11th Aug 2009 04:13
Perfect. Thanks! Knew it couldn't be that difficult, just didn't know what it was called.

Login to post a reply

Server time is: 2025-06-01 09:46:35
Your offset time is: 2025-06-01 09:46:35