Re: SetCapture

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

From: Norman Bullen (norm_at_BlackKittenAssociates.com.INVALID)
Date: 09/02/04


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.


Relevant Pages

  • SixFiles Best Mac OS X Freebies
    ... The latest Mac OS X freeware software news from Mac.SixFiles.com. ... The Image Browser window is split into two sections. ... screentabular display in an overview windowdisplay in the menu-bardisplay ... * Capture Me 1.3.2 ...
    (comp.sys.mac.apps)
  • Re: SixFiles Best Mac OS X Freebies
    ... The Image Browser window is split into two sections. ... authenticated open and saves, command-line utility, .Mac synchronisation, ... screentabular display in an overview windowdisplay in the menu-bardisplay ... * Capture Me 1.3.2 ...
    (comp.sys.mac.apps)
  • Re: Right-click causes crash in OE 6
    ... If you get the IE Error Reporting Tool window you can click ... on the Click here button and capture the Error Signature on ... by starting drwtsn32 or you may find an Event log entry in Event ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Virtual Display Driver
    ... This is why I created the example in my Gradient Fill Explorer: I wanted to capture more ... than the visible part of the window. ... pass in the origin based on the scrolling position and the size based on the client area. ... a few days, does not require any virtual display driver at all, and requires some minor ...
    (microsoft.public.vc.mfc)
  • Re: SOME ASSISTANCE NEEDED
    ... > I will check into the video capture soon. ... everything necessary to do captures by seeing the images on the TV Monitor, ... not having the image show in the MovieCapture window is no big deal. ... This morning I found that one HAS to use the "Matrox Video Tools" if one is ...
    (rec.video.production)