How to get the handle of context-menu(right click) in notepad ?

Hi All,

I'm new to windows programming.

I'm able to get the handle of "notepad window" using
hwnd = GetForegroundWindow(); // notepad is the foreground window

If I pass notepad window handle to "GetWindow(hwnd, 6)", it suppose gives me the handle of context-menu(right-click menu or pop-up). But it is not giving.

HWND hwnd1;

hwnd1 = GetWindow(hwnd,6);


I have printed the value of "hwnd1" it is always 0 for notepad.

I have tested the same for google chrome window. It is working.

If any of you know the reason why it is happening please let me know and suggest me how to proceed. It would be very helpful for me.


Topic archived. No new replies allowed.