win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinSetCapture (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WININPUT
 
BOOL WinSetCapture(hwndDesktop, hwnd)
HWND hwndDesktop;   /* handle of the desktop                              */
HWND hwnd;          /* handle of the window to receive all mouse messages */
 
The WinSetCapture function sets the mouse capture to the specified window.
With the mouse capture set to a window, all mouse input is directed to that
window, regardless of whether the mouse is over that window. Only one window
can have the mouse captured at a time.
 
When the WinSetCapture function is called to release the mouse capture, a
WM_MOUSEMOVE message is posted, regardless of whether the mouse pointer has
actually moved.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hwndDesktop  Identifies the desktop window. This parameter can be
             HWND_DESKTOP or the desktop window handle.
 
hwnd         Identifies the window that is to receive all mouse messages.
             This parameter can take the special value HWND_THREADCAPTURE to
             capture the mouse to the current thread rather than to a
             particular window. If hwnd is NULL, mouse capture is released.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs. If an application calls this function while the mouse is currently
captured by a different window, the function will fail and return FALSE.
 
See Also
 
WinQueryCapture, WM_MOUSEMOVE