Re: Capturing Mouse events outside Modal dialog box

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Nobody" <nobody@xxxxxxx> wrote in message
news:Trkng.2905$Nv.1233@xxxxxxxxxxxxx

<goelparesh@xxxxxxxxx> wrote in message
news:1151166847.297085.98340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, I wanted to capture mouseUp events occuring outside my modal dialog
box.
SetCapture seems to work only when the mouse is first Held Down in the
dialog box and then dragged outside.

Is there a way I can capture mouseUp events occuring outside my modal
dialog box without requiring the user to drag the mouse?

TIA


Why would you want to capture WM_LBUTTONUP outside your dialog box if its
not there from some kind of drag operation? SetCapture() wont work because
capture is automatically released by the OS when your app is not the
foreground application.

You can use a mouse hook, or better yet a journal hook (better performance).
If you use a mouse hook, you are going to be injecting your DLL into every
process which is pretty obnoxious.

A WH_MOUSE_LL hook is a global hook which doesn't get injected into all
processes...

--

- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools


.



Relevant Pages

  • Re: Capturing Mouse events outside Modal dialog box
    ... SetCapture seems to work only when the mouse is first Held Down in the ... Why would you want to capture WM_LBUTTONUP outside your dialog box if its ... not there from some kind of drag operation? ... You can use a mouse hook, or better yet a journal hook. ...
    (microsoft.public.win32.programmer.ui)
  • Re: check left mouse button state anywhere on the screen
    ... See my essay on hooks on my MVP Tips site. ... SetCapture will send you WM_MOUSEMOVE and WM_LBUTTONDOWN from all over the ... And your window will endup eating all these mouse ... With a mouse hook you will get all the mouse message in the system, ...
    (microsoft.public.vc.mfc)
  • Re: check left mouse button state anywhere on the screen
    ... You need to use a mouse hook, take a look at SetWindowsHookEx. ... SetCapture will send you WM_MOUSEMOVE and WM_LBUTTONDOWN from all over the screen, but it will stop after the first click outside of the window that called SetCapture. ... With a mouse hook you will get all the mouse message in the system, and you will have an option to cancel a message so the receiving window never sees it. ...
    (microsoft.public.vc.mfc)
  • Re: Detect automatically of lossing focus
    ... For a popup, SetCapture(), otherwise timer or mouse hook (with ...
    (microsoft.public.win32.programmer.ui)
  • Re: DART nearly a bullseye
    ... >> capability/requirements of a delivery vehicle to the Space Station. ... > tethering you have a set of capture conditions to catch the tether. ... At the Rbar or close to it, the Hook attachers, then ...
    (sci.space.shuttle)