PRB: Dialog in InitInstance Doesn't Process WM_DDE_INITIATE

Last reviewed: September 12, 1997
Article ID: Q173261
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Editions, versions 2.0, 2.1, 2.2, 4.0,

         4.1, 4.2, 5.0
    

SYMPTOMS

When you try to start an application that contains a modal dialog function, such as CDialog::DoModal, AfxMessageBox, or MessageBox, that is called from the CWinApp derived class' InitInstance function by double-clicking on the application from the Windows 95 Explorer, selecting the saved document from the Start Menu or double-clicking on it from File Manager, one of the following may happen:

  1. It may work fine if built with Visual C 2.x running under Windows NT 3.5x and later.

-or-

  1. The dialog or message box may come up, but the application's main window may not come up, and the process is now hung, and can only be terminated by PVIEW.

-or-

  1. The following error message box may be displayed:

          Cannot find the file <path\filename> (or one of its components).
          Make sure the path and filename are correct and that all required
          libraries are available.
    

        And, symptom number 2 may also occur.
    

CAUSE

When you launch an application in File Manager or Windows Explorer, a WM_DDE_INITIATE is supposed to be handled by the CWinApp and CFrameWnd OnDDEIntitiate handlers. A call to CDialog::DoModal, AfxMessageBox, or MessageBox interferes with the ability for the MFC framework to handle these messages correctly.

RESOLUTION

It has been determined that this behavior is by design and that it is not recommended to place any of these calls within the CWinApp::InitInstance. Any password dialogs or dialog based components which need to be displayed in the InitInstance should be of the modeless type. This does not apply to a dialog based application or an SDI application.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create an AppWizard Multiple Document Application, specifying a file extension to associate with the application.

  2. Call a modal dialog function such as CDialog::DoModal, AfxMessageBox, or MessageBox from the CWinApp derived class' InitInstance function.

  3. Run the application, dismiss the dialog or message box, and save the document.

  4. Start the application by:

    - Double-clicking on the application from the Windows 95 Explorer.

    -or-

    - Selecting the saved document from the Start Menu

    -or-

    - Double-clicking on the application from File Manager.

REFERENCES

For related information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q172336
   TITLE     : PRB: Assertion Launching Program with Tip of Day & Splash
                    Screen


Additional query words: explorer start file manager
Keywords : MfcMisc
Technology : kbMfc
Version : WINDOWS NT:2.0,2.1,2.2,4.0,4.1,4.2,5.0
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.