You may just pass
this
(that is the pointer to the
CDialog
itself) instead of
pParentWnd
.
[Update]
Please note
myButton
shouldn't be a local variable (it should be a class member).
I used the following code in the about dialog of a MFC SDI application:
class CAboutDlg : public CDialog
{
CButton myButton;
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
CRect(10,10,100,30), this, 1);
return TRUE;
}
It is working fine (it shows the button).
[/Update]