Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Clicking outside a modal dialog

Posted on 1999-07-14
5
Medium Priority
?
824 Views
Last Modified: 2013-12-03
How can I detect a mouse click ouside a modal dialog?
0
Comment
Question by:arkady
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:Shay050799
ID: 1402944
you can't
0
 

Expert Comment

by:nibbler
ID: 1402945
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



0
 

Author Comment

by:arkady
ID: 1402946
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?
0
 

Accepted Solution

by:
afzalmj earned 300 total points
ID: 1402947
Easy, use
SetWindowsHookEx(WH_MOUSE, (HOOKPROC)MouseProc, NULL, 0);
Where mouseproc is the mouse procedure which captures the clicks (HC_ACTION).
0
 

Author Comment

by:arkady
ID: 1402948
That worked fine, thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question