How do I make a button respond to a right click event? Whenever I right click on any part of a window of my prog, it shows the popup menu I created but when I right click on the button, it doesn't show. Any ideas how?

:D

-- audioman
Posted on 2005-04-14 07:03:52 by audioman
Use SetWindowLong on the Button with the GWL_WNDPROC and pipe it's messages through another WindowProc where you catch the WM_RBUTTONDOWN message and show your PopupMenu.

Check out Iczelions Tut about subclassing : http://win32assembly.online.fr/tut20.html
Posted on 2005-04-14 07:24:49 by JimmyClif
Hmm.. ok. Here's the problem now: Whenever i make a subclass of the button, it doesn't respond to the mouse events.
here's what i did: (pseudo code)

New Proc part:

if msg = WM_RBUTTONDOWN
  show popmenu
else
  invoke CallWindowProcA
endif



It doesn't respond to any mouse clicks, when i click on it, it doesn't push the button.. but when i dont subclass it, it works..

--audioman
Posted on 2005-04-14 09:29:38 by audioman
Attached code works..

Added WM_COMMAND handler for both Menu & Button as previous code had a little error
Posted on 2005-04-14 09:48:29 by JimmyClif
Your code works when I put it in a new file but when I applied it to my program, it still doesnt work. I think it doesn't work because of the mousehook.. any ideas?

EDIT: Just tested it again, I removed the mousehook code, it still doesn't work. So, it musn't be the mousehook.
EDIT2: I got it now. The problem I included a pushad/popad in the new Procedure.

Thanks for your help!

:D

--audioman
Posted on 2005-04-14 20:06:23 by audioman
You're welcome.
Posted on 2005-04-14 20:28:52 by JimmyClif