制作zCommas的… >>
<< How to bring windo…
Activate and bring t…

Author Zhou Renjian Create@ 2004-01-22 18:19 Modified@ 2004-01-22 19:30
whizz Note icon

Activate and bring the window to the foreground
LRESULT CXBrowserDlg::OnActiveKey(WPARAM, LPARAM lParam)
{
?HWND hWnd;
?CString title("waNote Demo - Microsoft Internet Explorer");
?hWnd=::FindWindow(NULL,title);

?HWND hCurrWnd;
?int iMyTID;
?int iCurrTID;

?hCurrWnd = ::GetForegroundWindow();
?iMyTID?? = GetCurrentThreadId();
?iCurrTID = GetWindowThreadProcessId(hCurrWnd,0);

?AttachThreadInput(iMyTID, iCurrTID, TRUE);

?::SetForegroundWindow(m_hWnd);
?if(::IsIconic(hWnd)) {
??::ShowWindowAsync(hWnd, SW_SHOWNOACTIVATE);
//?Activate if the window is minimized
?}
?::SetForegroundWindow(hWnd);
// Bring to the foreground
?AttachThreadInput(iMyTID, iCurrTID, FALSE);

?return TRUE;
}

本记录所在类别:
本记录相关记录: