Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

creating child dialog from the parent handle

$
0
0
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

Viewing all articles
Browse latest Browse all 3046

Trending Articles