Windows98/2000以降でWindowをアクティブにする Windows98/2000以降でWindowをアクティブにするには単純にSetForegroundWindow()を実行するだけではだめになりました。AttachThreadInputにより他のスレッドへの入力のアタッチをする必要があります。
void SetForegroundWindowEx(HWND hWnd)
{
int targetThread, selfThread;
// Threadのインプットのアタッチ
targetThread = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
selfThread = GetCurrentThreadId();
AttachThreadInput(selfThread, targetThread, TRUE );
// ウィンドウをフォアグラウンドに持ってくる
SetForegroundWindow(hWnd);
// Threadを切り離す
AttachThreadInput(selfThread, targetThread, FALSE );
}
目次に戻る
| Copyright(c) 2008 WoodenSoldier Software |
|