看看这个吧 CWnd::SetForegroundWindow BOOL SetForegroundWindow( );Return ValueNonzero if the function is successful; otherwise 0.ResPuts the thread that created the 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 foreground window is the window with which the user is currently working. The foreground window applies only to top-level windows (frame windows or dialogs boxes).
前提的到窗口句柄 1.BOOL SetForegroundWindow( HWND hWnd );2.BOOL SetWindowPos( HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags ); hWndInsertAfter :HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.3.BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );pWndInsertAfter :wndTopMost Places the window above all nontopmost windows. The window maintains its topmost position even when it is deactivated.
其他的请查阅文档
培养你的独立能力,呵呵
CWnd::SetForegroundWindow
BOOL SetForegroundWindow( );Return ValueNonzero if the function is successful; otherwise 0.ResPuts the thread that created the 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 foreground window is the window with which the user is currently working. The foreground window applies only to top-level windows (frame windows or dialogs boxes).
SetWindowPos(&wndTopMost,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
1.BOOL SetForegroundWindow( HWND hWnd
);2.BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
hWndInsertAfter :HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.3.BOOL SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);pWndInsertAfter :wndTopMost
Places the window above all nontopmost windows. The window maintains its topmost position even when it is deactivated.
SetParent(NULL);
SetWindowPos(&wndTopMost,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);