May 3rd, 2025, 08:38 AM
#1
creating child dialog from the parent handle
Hello,
In the legacy code, I have a diaglog opening up.
But I want to open another window on top of that. So I had written following code on branch for sometime now.
When I test the child window pops up, but a debug ASSERT is hit.
Any hints/comments on this is very helpful. I have written a new file for WVCWOptionsDlg
Code:
bool CWaveSightImp::Internal::SetupCWOptions(HWND hwndParent)
{
CWnd* pWnd = hwndParent ? CWnd::FromHandle(hwndParent) : NULL;
WVCWOptionsDlg optionsDlg(&m_reportOptions, pWnd);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
INT_PTR nRet = optionsDlg.DoModal();
if (nRet == IDCANCEL)
return false;
return true;
}
Code:
class WVCWOptionsDlg : public CDialog
{
DECLARE_DYNAMIC(WVCWOptionsDlg)
public:
WVCWOptionsDlg(WVCWReportOptions* pOptions, CWnd* pParent = NULL);
virtual ~WVCWOptionsDlg();
enum { IDD = IDD_WV_CW_OPTIONS_DLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
// virtual void OnOK();
void SetDefaultOptions();
//void ReadFromRegistry();
//void WriteToRegistry();
CButton m_EN_Radio;
CButton m_LL_Radio;
CButton m_dec_LL_Radio;
CButton m_fileCheck;
CButton m_binCheck;
CButton m_overallCheck;
CButton m_clutterCheck;
CComboBox m_reportCombo;
WVCWReportOptions* m_pReportOptions;
public:
DECLARE_MESSAGE_MAP()
afx_msg void OnOK();
};
As attached the call stack, the handle is coming as NULL, but Im able to see the new dialog popping up after the ASSERT !
Thankyou
Attached Images
Last edited by pdk5; May 3rd, 2025 at 08:53 AM .
May 8th, 2025, 02:33 AM
#2
Re: creating child dialog from the parent handle
Originally Posted by
pdk5
As attached the call stack,
The screenshot shows no call stack. Please stick with commonly used terminology.
Originally Posted by
pdk5
the handle is coming as NULL, but Im able to see the new dialog popping up after the ASSERT !
This is a C++ object wrapping a Win32 window object. hWnd is going to be NULL right until the moment when the window gets created. Since it is NULL, the dialog window is not created yet.
Best regards,
Igor
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width