⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_23375.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:23375 发表者:母鸡狂嚎 发表日期:2002-12-03 17:27:37
<br>主题:基于对话框程序的窗体始终显示于最顶层的实现方法?
<br>内容:怎么样最方便能实现?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:CDMA2000 回复日期:2002-12-03 17:30:57
<br>内容:用SetWindowPos设置顶层风格啊,你在MSDN中查看SetWindowPos()
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:母鸡狂嚎 回复日期:2002-12-03 18:19:07
<br>内容:&nbsp;&nbsp;&nbsp;&nbsp;对基于SDI、MDI的运用程序,要实现最高窗口,只要在框架窗口类CMainFrame中的PreCreateWindow()函数中加入“cs.dwExStyle =WS_EX_TOPMOST;”即可。<BR>&nbsp;&nbsp;&nbsp;&nbsp;对于基于对话框的程序,要实现窗体的最顶层,要重载对话框的OnInitDialog()函数,加入以下语句:<BR>&nbsp;&nbsp;&nbsp;&nbsp;const CWnd * pWndInsertAfter;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pWndInsertAfter = &amp;wndTopMost;<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetWindowPos(pWndInsertAfter,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;函数SetWindowPos原型为BOOL SetWindowPos(const CWnd * pWndInsertAfter,int x,int y,int cx,int cy,UINT nFlags);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pWndInsertAfter为指向标识窗口类型的CWnd对象的指针。<BR>&nbsp;&nbsp;&nbsp;&nbsp;x,y为窗口左上角的坐标。<BR>&nbsp;&nbsp;&nbsp;&nbsp;cx,cy为窗口的宽与高。<BR>&nbsp;&nbsp;&nbsp;&nbsp;nFlags确定窗口的大小及位置。当为SWP_NOSIZE时,忽略cx,cy。当为SWP_NOMOVE时,忽略x,y。<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:Norton AntiVirus 回复日期:2002-12-03 18:20:26
<br>内容:CRect rc;<BR>GetWindowRect(&amp;rc);<BR>pDialog-&gt;SetWindowPos(&amp;wndTopMost, rc.left, rc.top, rc.Width(), rc,Height(), SWP_SHOWWINDOW);
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -