ㅡ.ㅡ ::SetForegoundWindow() 가 호출은 정상으로 되나 동작을 이상하게 할때가 있음.
특히 #Windows7 일때.
그럴때 써볼만한 팁들 모음
1. How to bring window to top with SetForegroundWindow()
2. SetForegroundWindow Win32-API not always works on Windows-
void SetForegroundWindowInternal(HWND hWnd) { if(!::IsWindow(hWnd)) return; //relation time of SetForegroundWindow lock DWORD lockTimeOut = 0; HWND hCurrWnd = ::GetForegroundWindow(); DWORD dwThisTID = ::GetCurrentThreadId(), dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0); //we need to bypass some limitations from Microsoft :) if(dwThisTID != dwCurrTID) { ::AttachThreadInput(dwThisTID, dwCurrTID, TRUE); ::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0); ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); ::AllowSetForegroundWindow(ASFW_ANY); } ::SetForegroundWindow(hWnd); if(dwThisTID != dwCurrTID) { ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); ::AttachThreadInput(dwThisTID, dwCurrTID, FALSE); } }