SetCapture

2.x

  HWND SetCapture(hwnd)    
  HWND hwnd; /* handle of window to receive all mouse messages */

The SetCapture 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 cursor is over that window. Only one window can have the mouse capture at a time.

Parameters

hwnd

Identifies the window that is to receive all mouse messages.

Return Value

The return value is the handle of the window that previously received all mouse input, if the function is successful. It is NULL if there is no such window.

Comments

When the window no longer requires all mouse input, the application should call the ReleaseCapture function so that other windows can receive mouse input.

See Also

ReleaseCapture