SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.
TopHwnd=FindWindow(NULL,TEXT("MyProg"));
SetForegroundWindow(TopHwnd);0D
BOOL SetForegroundWindow(
0A HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window that should be activated and brought to the foreground.
Return Values
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.
SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.
BOOL SetForegroundWindow(
0A HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window that should be activated and brought to the foreground.
Return Values
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.