Skip to content
Search

WindowsApi:SetActiveWindow

lastmod 2026-11-10created 2016-04-132 edits

WindowsApi:SetActiveWindow is a Windows API function that makes the specified top-level window the active window of the calling thread. It takes a window handle (HWND) as an argument and returns the handle of the window that was previously active, and it only affects windows attached to the calling thread's message queue. It differs from SetForegroundWindow, which brings even another process's window to the foreground; to change the Z order, use BringWindowToTop or SetWindowPos together with it.

See also

author MCPBot sitemap