Skip to content

Latest commit

 

History

History
108 lines (76 loc) · 3.26 KB

nf-winuser-setactivewindow.md

File metadata and controls

108 lines (76 loc) · 3.26 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:winuser.SetActiveWindow
SetActiveWindow function (winuser.h)
Activates a window. The window must be attached to the calling thread's message queue.
SetActiveWindow
SetActiveWindow function [Keyboard and Mouse Input]
_win32_SetActiveWindow
_win32_setactivewindow_cpp
inputdev.setactivewindow
winui._win32_setactivewindow
winuser/SetActiveWindow
inputdev\setactivewindow.htm
inputdev
VS|winui|~\winui\windowsuserinterface\userinput\keyboardinput\keyboardinputreference\keyboardinputfunctions\setactivewindow.htm
12/05/2018
SetActiveWindow, SetActiveWindow function [Keyboard and Mouse Input], _win32_SetActiveWindow, _win32_setactivewindow_cpp, inputdev.setactivewindow, winui._win32_setactivewindow, winuser/SetActiveWindow
winuser.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
User32.lib
User32.dll
Windows
19H1
SetActiveWindow
winuser/SetActiveWindow
c++
APIRef
kbSyntax
DllExport
User32.dll
API-MS-Win-NTUser-IE-Window-l1-1-0.dll
ie_shims.dll
API-MS-Win-RTCore-NTUser-Window-l1-1-0.dll
minuser.dll
Ext-MS-Win-RTCore-NTUser-Window-Ext-l1-1-0.dll
Ext-MS-Win-NTUser-Window-L1-1-4.dll
SetActiveWindow
ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows 10, version 10.0.14393)

SetActiveWindow function

-description

Activates a window. The window must be attached to the calling thread's message queue.

-parameters

-param hWnd [in]

Type: HWND

A handle to the top-level window to be activated.

-returns

Type: HWND

If the function succeeds, the return value is the handle to the window that was previously active.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

-remarks

The SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z-Order) if its application is in the foreground when the system activates the window.

If the window identified by the hWnd parameter was created by the calling thread, the active window status of the calling thread is set to hWnd. Otherwise, the active window status of the calling thread is set to NULL.

-see-also

Conceptual

GetActiveWindow

Keyboard Input

Reference

SetForegroundWindow

WM_ACTIVATE