Re: SetCapture
From: Norman Bullen (norm_at_BlackKittenAssociates.com.INVALID)
Date: 09/02/04
- Next message: garrettc: "Re: _findnext always gives Access Violation"
- Previous message: William DePalo [MVP VC++]: "Re: GetModuleFileNameEx"
- In reply to: William DePalo [MVP VC++]: "Re: SetCapture"
- Next in thread: William DePalo [MVP VC++]: "Re: SetCapture"
- Reply: William DePalo [MVP VC++]: "Re: SetCapture"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 02 Sep 2004 00:46:38 GMT
William DePalo [MVP VC++] wrote:
> "daniel kaplan" <nospam@nospam.com> wrote in message
> news:1094071042.257140@nntp.acecape.com...
>
>>strange SetCapture behavior...if i udnerstand it correctly.....one of my
>>dialogboxes calls SetCApture...i even call GetCapture to make sure it
>>worked...but when i have a BEEP within WM_MOUSEMOVE, it only beeps when
>>the
>>cursor is moving WITHIN the dialog that captured the mouse...not any other
>>window...inlcuding windows from ther same app....
>>
>>did i misunderstnad SetCapture?
>
>
> I think so. This is from the docs:
>
> <quote>
> The SetCapture function sets the mouse capture to the specified window
> belonging to the current thread. SetCapture captures mouse input either when
> the mouse is over the capturing window, or when the mouse button was pressed
> while the mouse was over the capturing window and the button is still down.
> Only one window at a time can capture the mouse.
> </quote>
>
> Under Win32 you can't "capture" the mouse across "applications" as you could
> under 16 bit Windows. The only time that "works" is while the mouse button
> remains down after leaving the capturing window.
>
> You may want to take a step back and start with a description of _what_ you
> want to do and not _how_ you want to do it. If it is feasible and
> reasonable, you will probably get a suggestion.
>
> Regards,
> Will
>
>
>
>
>
The wording is slightly different in the Feb.2003 PSDK.
<quote>
Only the foreground window can capture the mouse. When a background
window attempts to do so, the window receives messages only for mouse
events that occur when the cursor hot spot is within the visible portion
of the window. Also, even if the foreground window has captured the
mouse, the user can still click another window, bringing it to the
foreground.
When the window no longer requires all mouse input, the thread that
created the window should call the ReleaseCapture function to release
the mouse.
This function cannot be used to capture mouse input meant for another
process.
When the mouse is captured, menu hotkeys and other keyboard accelerators
do not work.
<\quote>
Note the mention of foreground, suggesting that SetCapture() won't work
it the hWnd passed to the function is not the foreground window or
thread calling it does not own the foreground window.
This still does not mention behavior that I have relied upon in the
past: SetCapture(hWnd) will redirect mouse messages to hWnd if the
cursor is over any other window owned by the same thread, whether on not
a button is pressed.
Norm
-- -- To reply, change domain to an adult feline.
- Next message: garrettc: "Re: _findnext always gives Access Violation"
- Previous message: William DePalo [MVP VC++]: "Re: GetModuleFileNameEx"
- In reply to: William DePalo [MVP VC++]: "Re: SetCapture"
- Next in thread: William DePalo [MVP VC++]: "Re: SetCapture"
- Reply: William DePalo [MVP VC++]: "Re: SetCapture"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|