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

📄 subject_16895.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:16895 发表者:Wang Bei 发表日期:2002-10-05 16:04:51
<br>主题:窗口最小化
<br>内容:如何在窗口失去焦点的时候,让窗口最小?<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>
<font color=red>答案被接受</font><br>回复者:黄飚 回复日期:2002-10-05 20:16:20
<br>内容:请在该消息函数调用ShowWindow(SW_MINIMIZE&nbsp;&nbsp; ),给分吧,我特别需要分!谢谢<BR>CWnd::ShowWindow<BR>BOOL ShowWindow( int nCmdShow );<BR><BR>Return Value<BR><BR>Nonzero if the window was previously visible; 0 if the CWnd was previously hidden.<BR><BR>Parameters<BR><BR>nCmdShow<BR><BR>Specifies how the CWnd is to be shown. It must be one of the following values: <BR><BR>SW_HIDE&nbsp;&nbsp; Hides this window and passes activation to another window.<BR><BR><BR>SW_MINIMIZE&nbsp;&nbsp; Minimizes the window and activates the top-level window in the system’s list.<BR><BR><BR>SW_RESTORE&nbsp;&nbsp; Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.<BR><BR><BR>SW_SHOW&nbsp;&nbsp; Activates the window and displays it in its current size and position.<BR><BR><BR>SW_SHOWMAXIMIZED&nbsp;&nbsp; Activates the window and displays it as a maximized window.<BR><BR><BR>SW_SHOWMINIMIZED&nbsp;&nbsp; Activates the window and displays it as an icon.<BR><BR><BR>SW_SHOWMINNOACTIVE&nbsp;&nbsp; Displays the window as an icon. The window that is currently active remains active.<BR><BR><BR>SW_SHOWNA&nbsp;&nbsp; Displays the window in its current state. The window that is currently active remains active.<BR><BR><BR>SW_SHOWNOACTIVATE&nbsp;&nbsp; Displays the window in its most recent size and position. The window that is currently active remains active.<BR><BR><BR>SW_SHOWNORMAL&nbsp;&nbsp; Activates and displays the window. If the window&nbsp;&nbsp;is minimized or maximized, Windows restores it to its original size and position. <BR>Remarks<BR><BR>Sets the visibility state of the window. <BR><BR>ShowWindow must be called only once per application for the main window with CWinApp::m_nCmdShow. Subsequent calls to ShowWindow must use one of the values listed above instead of the one specified by CWinApp::m_nCmdShow.<BR><BR>CWnd Overview |&nbsp;&nbsp;Class Members |&nbsp;&nbsp;Hierarchy Chart<BR><BR>See Also&nbsp;&nbsp; ::ShowWindow, CWnd::OnShowWindow, CWnd::ShowOw<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>
回复者:浩公 回复日期:2002-10-05 22:16:18
<br>内容:响应WM_KILLFOCUS
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Frog 回复日期:2002-10-06 16:19:19
<br>内容:你试试这样.<BR>HWND&nbsp;&nbsp; hw;<BR>hw=::FindWindow(NULL,"testw");<BR>if(hw)<BR>&nbsp;&nbsp;::ShowWindow( hw , SW_MINIMIZE) ;<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>
回复者:Wang Bei 回复日期:2002-10-07 08:53:57
<br>内容:谢谢大家的帮忙。<BR>我还想知道该在那个消息函数里调用ShowWindow的操作?<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>
回复者:黄飚 回复日期:2002-10-07 10:37:57
<br>内容:你可以点击该类,点击鼠标右键,有Message Handle里,出现菜单,选择WM_KILLFOCUS双击,就会自动在你的.h,.cpp里加上相应的消息函数
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Wang Bei 回复日期:2002-10-07 14:28:44
<br>内容:没有作用。<BR><BR>我用的是基于对话框的工程,<BR>void CSSMvdmDlg::OnKillFocus(CWnd* pNewWnd) <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CDialog::OnKillFocus(pNewWnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your message handler code here<BR>&nbsp;&nbsp;&nbsp;&nbsp;ShowWindow(SW_SHOWMINIMIZED);<BR>}<BR>但是,在主对话框失去焦点,比如被别的窗口遮住时,并不调用OnKillFocus的消息。<BR><BR>该怎么办呢?很着急的。。。<BR><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>
回复者:Frog 回复日期:2002-10-07 15:26:58
<br>内容:你是想在同一个程序中实现吗?如是,就用WM_KILLFOCUS消息<BR>如果想让另一个程序使本程序的窗口最小化,就用我上面的代码.其中"testw"是你要最小化的窗口的标题
<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 + -