SetForegroundWindow

This function puts the thread that created the specified window into the foreground and activates the window.

At a Glance

Header file: Winuser.h
Windows CE versions: 1.0 and later

Syntax

BOOL SetForegroundWindow(HWND hWnd);

Parameters

hWnd

[in] Handle to the window that should be activated and brought to the foreground.

Return Values

Nonzero indicates that the window was brought to the foreground. Zero indicates that the window was not brought to the foreground.

Remarks

The foreground window is the window at the top of the z-order. It is the window that the user is working with. In a preemptive multitasking environment, you should generally let the user control which window is the foreground window.

The thread that owns the window is not given a priority boost.

See Also

GetForegroundWindow, SetActiveWindow