Modeless child dialog

Serializing ASCII Data
Modeless child dialog
Modeless sibling dialog
The drag source
The MFC drop target
The TBTextTarget class
VC6 flat toolbar support



Create a modeless dialog box as child window

Code Sample for this one is

To create the modeless dialog as sibling, follow this link.

Follow these steps:

  1. Create a new dialog resource and use the Class Wizard for making a new CDialog based class for it; let’s call it CDropDialog
  2. In your CFormView-derived class, add a (private) member variable of type CDropDialog* as a container for the modeless dialog object, let’s call it m_pModeless. In the constructor of your view, make sure you initialize m_pModeless to NULL
  3. In your appropriate message handler, let’s call it OnModeless, do the following:
    void CInterfaceView::OnModeless() 
        // Display the modal dialog box
        if (!m_pModeless)
            m_pModeless = new CDropDialog;
        if (!::IsWindow(m_pModeless->GetSafeHwnd()))
            m_pModeless->Create(IDD_DIALOG1, this);
In the destructor of the parent window, proof if the dialog has been closed and release the memory:
    if (m_pModeless)
        if (::IsWindow(m_pModeless->GetSafeHwnd()))
        delete m_pModeless;