將視窗提到最前面的方式
發表於 : 2008年 11月 27日, 17:16
window 2000之後版本,需要先取得該視窗焦點才可以SetForegroundWindow,最後在釋放
實作如下:
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),TRUE);
SetForegroundWindow();
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),FALSE);
實作如下:
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),TRUE);
SetForegroundWindow();
AttachThreadInput(GetWindowThreadProcessId(::GetForegroundWindow(),NULL),GetCurrentThreadId(),FALSE);