Navigation:  ThinBASIC Modules > UI (User Interface) > Windows API >

Win_SetCapture

Previous pageReturn to chapter overviewNext page

 

Description

 

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.

 

 

Syntax

 

n = Win_SetCapture(hWnd)

 

Returns

 

Number.

The return value is a handle to the window that had previously captured the mouse. If there is no such window, the return value is NULL

 

Parameters

 

Name

Type

Optional

Meaning

hWnd

Number

No

Handle to the window in the current thread that is to capture the mouse

 

Remarks

 

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 Win_ReleaseCapture function to release the mouse.

 

Restrictions

 

See also

 

Examples