Link to home
Start Free TrialLog in
Avatar of arkady
arkady

asked on

Clicking outside a modal dialog

How can I detect a mouse click ouside a modal dialog?
Avatar of Shay050799
Shay050799

you can't
Capture the mouse:
::SetCapture(HWND hwnd)
This will send all mouse events to your dialog..
until it releases the capture (could happen with Alt-Tab)
When you don't need the mouseinput anymore, call
::ReleaseCapture()

When loosing the capture you get a WM_CAPTURECHANGED message, so you KNOW when your capture is released by Alt-Tab

This is the only possibility ...

Hopes this helps :)

Rick



Avatar of arkady

ASKER

I know about capturing the mouse, but that makes the mouse useless in the dialog.  It's not an option for me.

Some kind of a window hook?
ASKER CERTIFIED SOLUTION
Avatar of afzalmj
afzalmj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arkady

ASKER

That worked fine, thanks.