怎么把后台窗口置前?(WINDOWS XP) SetForegroundWindow等不起作用! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试试下面的代码,应该可以 CString strCaption = _T("WhatYouWant"); CWnd* pwndFirst = CWnd::FindWindow(NULL, strCaption); if (pwndFirst) { CWnd* pwndPopup = pwndFirst->GetLastActivePopup(); pwndFirst->SetForegroundWindow(); pwndFirst->ShowWindow(SW_SHOWNORMAL); if (pwndFirst != pwndPopup) pwndPopup->SetForegroundWindow(); return FALSE; } 楼上的代码是可以的。CString strCaption = _T("WhatYouWant"); CWnd* pwndFirst = CWnd::FindWindow(NULL, strCaption); if (pwndFirst) { CWnd* pwndPopup = pwndFirst->GetLastActivePopup(); pwndFirst->SetForegroundWindow(); pwndFirst->ShowWindow(SW_SHOWNORMAL); if (pwndFirst != pwndPopup) pwndPopup->SetForegroundWindow(); return FALSE; } setforegroundwindow对Dialog不怎么灵,怪怪的,开始我也正不明白 ::SetWindowPos(this->m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);::SetWindowPos(this->m_hWnd, HWND_NOTOPMOST , 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); HWND tmphwnd=GetForegroundWindow();if(AttachThreadInput(GetCurrentThreadId(),GetWindowThreadProcessId(tmphwnd,NULL),1)){ SetActiveWindow((HWND)h); AttachThreadInput(GetCurrentThreadId(),GetWindowThreadProcessId(tmphwnd,NULL),0);} 如何实现VC与xml文件树形单击事件,有请各位大虾帮帮忙。小女子在此谢谢各位啦!着急用啊急急 菜鸟菜问 关于判断串口传输的DATA ado插入一条记录后,怎样获得这条记录的自增id值? DAO数据库问题,急~~~~~~~ 神那,救救我吧!窗口分割......(大分悬赏) 如何定制打印预览的界面 BitBlt 函数的问题 我想往屏幕当前窗口,当前焦点控件(编辑框)写一字符串,然后发送回车消息,怎么做 如何在对话框画直方图 [email protected] (高分)要建一个电子合同中心,应该用到那些技术?? VS.net 安装为什么老师提是要我插入组建更新光盘?
CWnd* pwndFirst = CWnd::FindWindow(NULL, strCaption);
if (pwndFirst)
{
CWnd* pwndPopup = pwndFirst->GetLastActivePopup();
pwndFirst->SetForegroundWindow();
pwndFirst->ShowWindow(SW_SHOWNORMAL);
if (pwndFirst != pwndPopup)
pwndPopup->SetForegroundWindow();
return FALSE;
}
CWnd* pwndFirst = CWnd::FindWindow(NULL, strCaption);
if (pwndFirst)
{
CWnd* pwndPopup = pwndFirst->GetLastActivePopup();
pwndFirst->SetForegroundWindow();
pwndFirst->ShowWindow(SW_SHOWNORMAL);
if (pwndFirst != pwndPopup)
pwndPopup->SetForegroundWindow();
return FALSE;
}
::SetWindowPos(this->m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
::SetWindowPos(this->m_hWnd, HWND_NOTOPMOST , 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
if(AttachThreadInput(GetCurrentThreadId(),GetWindowThreadProcessId(tmphwnd,NULL),1))
{
SetActiveWindow((HWND)h);
AttachThreadInput(GetCurrentThreadId(),GetWindowThreadProcessId(tmphwnd,NULL),0);
}