﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-zhcen-随笔分类-MFC</title><link>http://www.cppblog.com/zhcen/category/6399.html</link><description>C/C++</description><language>zh-cn</language><lastBuildDate>Wed, 21 May 2008 17:37:33 GMT</lastBuildDate><pubDate>Wed, 21 May 2008 17:37:33 GMT</pubDate><ttl>60</ttl><item><title>Destroy modeless dialog box</title><link>http://www.cppblog.com/zhcen/archive/2008/04/14/47017.html</link><dc:creator>陈振辉</dc:creator><author>陈振辉</author><pubDate>Mon, 14 Apr 2008 02:19:00 GMT</pubDate><guid>http://www.cppblog.com/zhcen/archive/2008/04/14/47017.html</guid><wfw:comment>http://www.cppblog.com/zhcen/comments/47017.html</wfw:comment><comments>http://www.cppblog.com/zhcen/archive/2008/04/14/47017.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zhcen/comments/commentRss/47017.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zhcen/services/trackbacks/47017.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="FONT-FAMILY: Verdana">When you implement a modeless dialog box, always override the <span style="COLOR: #0000ff">OnCancel</span> member function and call <span style="COLOR: #0000ff">DestroyWindow</span> from within&nbsp;&nbsp; it. Don&#8217;t call the base class <span style="COLOR: #0000ff">CDialog::OnCancel</span>, because it calls <span style="COLOR: #0000ff">EndDialog</span>, which will make the dialog box invisible but&nbsp;will not destroy it.&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You should also override <span style="COLOR: #0000ff">PostNcDestroy </span>for modeless dialog boxes in order to delete this, since modeless dialog boxes are usually allocated with new. Modal dialog boxes are usually constructed on the frame and do not need <span style="COLOR: #0000ff">PostNcDestroy</span> cleanup.</span>
<img src ="http://www.cppblog.com/zhcen/aggbug/47017.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zhcen/" target="_blank">陈振辉</a> 2008-04-14 10:19 <a href="http://www.cppblog.com/zhcen/archive/2008/04/14/47017.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Z-Order</title><link>http://www.cppblog.com/zhcen/archive/2008/04/07/zhcen20080408.html</link><dc:creator>陈振辉</dc:creator><author>陈振辉</author><pubDate>Mon, 07 Apr 2008 06:24:00 GMT</pubDate><guid>http://www.cppblog.com/zhcen/archive/2008/04/07/zhcen20080408.html</guid><description><![CDATA[<h3><a name=zorder></a>Z-Order</h3>
<p>The <em>z-order</em> of a window indicates the window's position in a stack of overlapping windows. This window stack is oriented along an imaginary axis, the z-axis, extending outward from the screen. The window at the top of the z-order overlaps all other windows. The window at the bottom of the z-order is overlapped by all other windows.</p>
<p>The system maintains the z-order in a single list. It adds windows to the z-order based on whether they are topmost windows, top-level windows, or child windows. A <em>topmost window</em> overlaps all other non-topmost windows, regardless of whether it is the active or foreground window. A topmost window has the <mshelp:link tabIndex=0 keywords="_mfc_extended_window_styles" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>WS_EX_TOPMOST</font></u></mshelp:link> style. All topmost windows appear in the z-order before any non-topmost windows. A child window is grouped with its parent in z-order.</p>
<p>When an application creates a window, the system puts it at the top of the z-order for windows of the same type. You can use the <mshelp:link tabIndex=0 keywords="_win32_BringWindowToTop_cpp" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>BringWindowToTop</font></u></mshelp:link> function to bring a window to the top of the z-order for windows of the same type. You can rearrange the z-order by using the <mshelp:link tabIndex=0 keywords="_win32_SetWindowPos_cpp" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>SetWindowPos</font></u></mshelp:link> and <mshelp:link tabIndex=0 keywords="_win32_DeferWindowPos_cpp" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>DeferWindowPos</font></u></mshelp:link> functions.</p>
<p>The user changes the z-order by activating a different window. The system positions the active window at the top of the z-order for windows of the same type. When a window comes to the top of z-order, so do its child windows. You can use the <mshelp:link tabIndex=0 keywords="_win32_GetTopWindow_cpp" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>GetTopWindow</font></u></mshelp:link> function to search all child windows of a parent window and return a handle to the child window that is highest in z-order. The <mshelp:link tabIndex=0 keywords="_win32_GetNextWindow_cpp" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"><u><font color=#0000ff>GetNextWindow</font></u></mshelp:link> function retrieves a handle to the next or previous window in z-order.</p>
<img src ="http://www.cppblog.com/zhcen/aggbug/46420.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zhcen/" target="_blank">陈振辉</a> 2008-04-07 14:24 <a href="http://www.cppblog.com/zhcen/archive/2008/04/07/zhcen20080408.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>