Partager via


SetForegroundWindow (Windows CE 5.0)

Send Feedback

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

BOOLSetForegroundWindow(  HWNDhWnd );

Parameters

  • hWnd
    [in] Handle to the window that should be activated and brought to the foreground. For more information, see the Remarks section.

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.

If the window being set to the foreground is minimized, the window may not be visible to the end user. This function also does not reactivate the last active child window by default. To ensure that the window is restored and the last active child window is reactivated, combine the handle to the window with 0x01 using the logical OR operator. For example:

SetForegroundWindow((HWND)(((ULONG) hwnd) | 0x01) );

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.

See Also

GetForegroundWindow | SetActiveWindow

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.