將視窗提到最前面的方式

有關於C/C++的語法, 程式等
回覆文章
aarontu
文章: 1
註冊時間: 2008年 11月 27日, 16:56

將視窗提到最前面的方式

文章 aarontu »

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