方法を教えてください。SetWindowPosを使用するのでしょうか? MFCです。
http://nienie.com/~masapico/api_SetForegroundWindow.html
SetForegroundWindow
SetForegroundWindowは いかがでしょうか?
SetForegroundWindow();
は自分自身をアクティブにします。
http://yokohama.cool.ne.jp/chokuto/urawaza/api/SetForegroundWind...
SetForegroundWindow
WindowsNT系と9x系で動作が若干異なるので、ちょっと工夫が必要です
SDKだとHWNDに目的のウィンドウのハンドルを入れます
がMFCの場合とはこの部分がちょっと変わります
以下にソースを書きます
SDK
DWORD DTID,ATID,PID;
DTID = GetWindowThreadProcessId(GetForegroundWindow(), &PID);
ATID = GetWindowThreadProcessId(HWND,&PID);
AttachThreadInput(ATID,DTID, TRUE);
SetForegroundWindow(HWND);
AttachThreadInput(ATID,DTID, FALSE);
SetActiveWindow(HWND);
MFC
DWORD DTID,ATID,PID;
DTID = GetWindowThreadProcessId(GetForegroundWindow(), &PID);
ATID = GetWindowThreadProcessId(pWnd->GetSafeHwnd(),&PID);
AttachThreadInput(ATID,DTID, TRUE);
pWnd->SetForegroundWindow();
AttachThreadInput(ATID,DTID, FALSE);
pWnd->SetActiveWindow();
おぉっ。できました!
ありがとうございます〜♪
うーん。うまくいかないです。
アクティブにはなるようなんですが、2つアクティブになっているような気がします。
XPだと普通に使っていてもこうなるので仕方ないのでしょうか?