Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function makes the specified top-level window associated with the thread calling this function the active window.
HWND SetActiveWindow( HWND hWnd );
Parameters
Return Values
The handle to the window that was previously active indicates success. NULL indicates failure. To get extended error information, call GetLastError.
Remarks
The SetActiveWindowfunction activates a window, but not if the application is in the background. The window will be brought into the foreground—the top of z-order—if the application is in the foreground when it sets the activation.
If the window identified by the hWndparameter 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.
For Windows CE versions 2.10 and later, if you call this function with hWndset to the handle of the child window, SetActiveWindowreturns NULL and sets the extended error value to zero.
The SetForegroundWindowwindow function, on the other hand, activates a window and forces it into the foreground. An application should only call SetForegroundWindowif it needs to display critical errors or information that needs the user's immediate attention.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Caret.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetActiveWindow, GetLastError, SetForegroundWindow, WM_ACTIVATE