End Google Ads 201810 - BS.net 01 --> My qustion is Why this happened???
if sibling window paint by Z-order according to MSDN doc, the button should not be painted after the dialog.
http://msdn.microsoft.com/en-us/libr...26(VS.85).aspx[^]
--------------------------------------------------------------
Do the follow simple step you will see the "magic" button:
1. Create MFC SDI project
2. At [resouce view], Add a dialog and set style child.(WS_CHILD)
3. Add this code to the *view.cpp to create to child window:
#define BTN1 10101
int CTestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;

// TODO: ?????????????????????
m_dlg.Create(CTestDlg::IDD, this);
m_dlg.ShowWindow(SW_SHOW);
RECT rect;
rect.left = 10;
rect.top = 100;
rect.right = 110;
rect.bottom = 125;
m_btn.Create(_T("testBtn"), WS_VISIBLE | BS_PUSHBUTTON, rect, this, BTN1);
return 0;
}

* CTestDlg m_dlg, CButton m_btn is member of the CTestView
* Z-order can be checked either by Spy++ or GetWindow API

You can fix the problem by add WS_CLIPSIBLINGS style of the button.
m_btn.Create(_T("testBtn"), WS_VISIBLE | BS_PUSHBUTTON | WS_CLIPSIBLINGS, rect, this, BTN1);