GetCapture function (Windows)

Switch View :
ScriptFree
GetCapture function

Applies to: desktop apps only

Retrieves a handle to the window (if any) that has captured the mouse. Only one window at a time can capture the mouse; this window receives mouse input whether or not the cursor is within its borders.

Syntax

HWND WINAPI GetCapture(void);

Parameters

This function has no parameters.

Return value

Type: HWND

The return value is a handle to the capture window associated with the current thread. If no window in the thread has captured the mouse, the return value is NULL.

Remarks

A NULL return value means the current thread has not captured the mouse. However, it is possible that another thread or process has captured the mouse.

To get a handle to the capture window on another thread, use the GetGUIThreadInfo function.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetGUIThreadInfo
ReleaseCapture
SetCapture
Conceptual
Mouse Input

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Content

dmex
C# syntax
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern IntPtr GetCapture();

dmex
vb.net syntax
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> Public Shared Function GetCapture() As IntPtr
End Function