Share via


GetFocus

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function retrieves the handle to the keyboard focus window associated with the thread that called the function.

Syntax

HWND GetFocus(void);

Parameters

None.

Return Value

The handle to the window with the keyboard focus indicates success. NULL indicates that the calling thread's message queue does not have an associated window with the keyboard focus.

Remarks

Even if GetFocus returns NULL, another thread's queue may be associated with a window that has the keyboard focus.

Use the GetForegroundWindow function to retrieve the handle to the window with which the user is currently working.

Requirements

Header winuser.h
Library Caret.lib, Foregnd.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetActiveWindow
GetForegroundWindow
GetCapture
SetFocus
WM_KILLFOCUS
WM_SETFOCUS
Keyboard Functions