哦原来如此。那就用这个:SetForegroundWindowThe 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( HWND hWnd // handle to window to bring to foreground );
那就再来一下好了:BringWindowToTop The BringWindowToTop function brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated. BOOL BringWindowToTop( HWND hWnd // handle to window );
发送sendkeys "%{TAB}"是另外一回事。
HWND hWnd // handle to window to bring to foreground
);
The BringWindowToTop function brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated. BOOL BringWindowToTop(
HWND hWnd // handle to window
);
winXP