在程序最开始处用这个,然后重新运行程序就好了。
hWnd = FindWindow(程序类名, 程序主窗口名);
if (hWnd)
{
// set focus to foremost child window
// The "| 0x00000001" is used to bring any owned windows to the foreground and
// activate them.
SetForegroundWindow((HWND)((ULONG)hWnd | 0x00000001));
return 0;
}