window 2000之後版本,需要先取得該視窗焦點才可以SetForegroundWindow,最後在釋放
實作如下:
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),TRUE);
SetForegroundWindow();
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),FALSE);