Alvaro
April 16th, 1999, 03:52 PM
I'm writing an application which uses Windows Hooks to detect when a pop-up menu is about to be displayed as a result of the user right-clicking inside another application. The idea is to disable one of the items in the pop-up menu before it gets displayed to prevent the user from invoking it.
I've been able to figure out how to intercept the pop-up menu when it comes up by checking for the WM_SHOWWINDOW message and then comparing its window class to "#32768". Unfortunately once I get the window handle (HWND) for it, I don't know how to turn it into a menu handle (HMENU) so I can call ModifyMenu on it. I've tried casting it but it doesn't work (IsMenu fails). Do you know how to go from a menu's HWND to its HMENU?
I appreciate your help!
Alvaro
I've been able to figure out how to intercept the pop-up menu when it comes up by checking for the WM_SHOWWINDOW message and then comparing its window class to "#32768". Unfortunately once I get the window handle (HWND) for it, I don't know how to turn it into a menu handle (HMENU) so I can call ModifyMenu on it. I've tried casting it but it doesn't work (IsMenu fails). Do you know how to go from a menu's HWND to its HMENU?
I appreciate your help!
Alvaro