CWindow::CenterWindow函数体温msdn:
Usually called from CDialog::OnInitDialog to center dialog boxes relative to the main window of the application.
 By default, the function centers child windows relative to their parent window, 
and pop-up windows relative to their owner.
 If the pop-up window is not owned, it is centered relative to the screen. 
To center a window relative to a specific window which is not the owner or parent, the pAlternateOwner parameter may be set to a valid window.
 To force centering relative to the screen, pass the value returned by CWnd::GetDesktopWindow as pAlternateOwner.
这段英文条几个概念:该函数会使子窗口 Centers他们 的父窗口, pop-up窗口Centers他们的拥有者。
奇怪,父窗口和拥有者不是一样的吗???

解决方案 »

  1.   

    CHILD类型的创建它的即它的父窗口
    POPUP类型创建它的不一定是它的父窗口
      

  2.   

    我觉得只有一种情况不是:没有父窗口的时候。基于对话框的工程。 就没有父窗口。 
    一个对话框上用BltBit画2张图片,来回切换。我想使该对话框在 主界面的中央处, 于是用了函数:CWnd::CenterWindow();不过用的时候,参数用了 默认值NULL.造成的后果: 对话框倒是在主界面的中央了, 但是 图片看不到了
    请问,这是什么原因导致的。
    工程是基于单文档工程。