如何让自己的窗口显示到最前面 自己的窗口不一定是激活的窗口,但是一定要显示到最前面,那位高手知道 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); SetWindowPos(HWND,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE); 同意上述方法,如果你的程序有闪屏,在2000,xp下运行时,会有一些问题,以下方法较好:在2K/XP下我们可以用 AttachThreadInput 和SetForegroundWindow来有效的获取焦点。//捕捉并设置当前焦点窗口为我们的窗口AttachThreadInput( GetWindowThreadProcessId( ::GetForegroundWindow(),NULL), GetCurrentThreadId(),TRUE);//置我们的为焦点窗口SetForegroundWindow();SetFocus(); //释放threadAttachThreadInput( GetWindowThreadProcessId( ::GetForegroundWindow(),NULL), GetCurrentThreadId(),FALSE); BOOL SetForegroundWindow( ); int rsAlwaysTop(LPSTR WINTITLE, bool onTop){ HWND hd=FindWindow(NULL,WINTITLE); if(hd) return SetWindowPos(hd,onTop ? HWND_TOPMOST : HWND_NOTOPMOST,0,0,0,0,3); return 0;} 如何提高消息的响应速度 请问如何做一个第三方软件的使用权限设置软件? 重叠io等待事件触发时间太长 我写的一个连连看“连通”算法 控件中如何响应鼠标的左右键的down和up消息? 按钮贴图后为什么闪烁? 高分请教,关于CSplitterWnd切分窗口的问题。 谁有类似IE收藏 中的树控制源程序 再加100分,犒劳ITGG,请进来看看? ADO: 如何在 m_pCommand->CommandText="" 中使用嵌套select 语句? 紧急求助,在线等待,马上给分(分不够再加)----关于调试跟踪. 小鸟的问题
以下方法较好:
在2K/XP下我们可以用 AttachThreadInput 和SetForegroundWindow来有效的获取焦点。//捕捉并设置当前焦点窗口为我们的窗口
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),TRUE);//置我们的为焦点窗口
SetForegroundWindow();
SetFocus(); //释放thread
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),FALSE);
HWND hd=FindWindow(NULL,WINTITLE); if(hd)
return SetWindowPos(hd,onTop ? HWND_TOPMOST : HWND_NOTOPMOST,0,0,0,0,3);
return 0;
}