How to bring windo…
Author
Zhou Renjian
Create@
2004-01-22 16:53
Modified@
2004-01-26 22:38
How to bring 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);
}
::SetForegroundWindow(hWnd);
AttachThreadInput(iMyTID, iCurrTID, FALSE);
return TRUE;
}
More about
http://visualcpp.net/index.php?qID=52