Greg Malcolm
Greg Malcolm

Reputation: 3397

Intercepting mouse clicks when the mouse is hovering above a control

I'm working on a MFC C++ dialog where I need to respond to right mouse click events for a dialog even if the mouse is hovering over a control.

I could write event handler code for each control to delegate the work to the parent dialog, but I'm hoping there is a more elegant solution?

I'm hoping there is some way to intercept the windows messages, but I'm still figuring that part out. I've tried listening to the WM_COMMAND messages with Spy++ but I didn't see what I needed.

Any suggestions?

Upvotes: 3

Views: 885

Answers (1)

Alan
Alan

Reputation: 13721

You could set up a hook to intercept mouse messages. Take a look at SetWindowsHookEx and WH_MOUSE

Upvotes: 4

Related Questions