Click to See Complete Forum and Search --> : Popup Menu
TadaTensai
Aug 14th, 2001, 06:13 PM
I'm working on a shell replacement.... Instead of a start menu, im wanting to make it so you right click on the desktop and it pops up a menu. I tried to do it from a resource, but I gave up on that. How do I do this? Same type of thing as a systray icon.
parksie
Aug 14th, 2001, 08:23 PM
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(MNU_MAIN));
if(!hMenu || !IsMenu(hMenu) || !pOwner || !IsWindow(pOwner->m_hWnd)) return -1;
POINT thePoint;
GetCursorPos(&thePoint);
SetForegroundWindow(hWndParent);
int iID = TrackPopupMenu(GetSubMenu(hMenu, 0), TPM_RIGHTALIGN | TPM_RETURNCMD, thePoint.x, thePoint.y, 0, pOwner->m_hWnd, NULL);
DestroyMenu(hMenu);The highlighted line is important for tray icons, not sure about when randomly popping things up.
parksie
Aug 14th, 2001, 08:24 PM
Oh yeah, it has to be a submenu off a menu, not on the root.
TadaTensai
Aug 15th, 2001, 05:53 PM
So how would this menu be layed out? (API or Diagram)
parksie
Aug 16th, 2001, 08:30 AM
This is what it should look like.
GetSubMenu(hMenu, 0) gets the first submenu (the opened one) and uses that.
PS: You might need to save this and open it separately if it doesn't work because something's up with the server's MIME types.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.