PRB: ATL COM AppWizard Doesn't Offer MFC Support for .EXE

Last reviewed: March 11, 1998
Article ID: Q181505
The information in this article applies to:
  • The AppWizard included with:

        - Microsoft Visual C++, 32-bit Editions, versions 5.0, 5.0sp1,
          5.0sp2, 5.0sp3
    

SYMPTOMS

The ATL COM AppWizard does not offer the option of MFC support for an .exe project. Adding an MFC class with ClassView or ClassWizard results in build errors.

RESOLUTION

To add minimal MFC support to an ATL COM AppWizard project, follow these steps:

  1. Open the ATL project with Visual C++.

  2. On the Project menu, click Settings.

  3. Under the General tab, set the Microsoft Foundation Classes field to "Use MFC in a Shared DLL" or "Use MFC in a Static Library". Click OK.

  4. Open the project StdAfx.h header file. Add the following line after "#define STRICT", then save and close the file:

          #include <afxdisp.h>
    

  5. Open the project .rc source file in text mode for editing:

    a. On the File menu, click Open.

    b. Highlight the <projectname>.rc file.

    c. Set the Open As field to "Text", then click Open.

    d. Click OK on any resulting message boxes.

  6. Replace all occurrences of Winres.h with Afxres.h in the .rc file, then save and close the file.

MFC class files added with ClassView or ClassWizard should now build without errors.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual C++, create a new ATL COM AppWizard project.

  2. In the wizard's Step 1, select either "Executable (EXE)" or "Service (EXE)".

    NOTE: The "Support MFC" check box is disabled.

  3. Finish the project. Click Finish, then click OK.

  4. On the ClassView pane of the new project, right-click the project name. Select New Class from the menu.

  5. Change Class Type to "MFC Class", give the class a name and a base class, then click OK.

  6. Build the project.

Build errors prevent the build step from completing successfully.

REFERENCES

For more detailed information on adding MFC support to an ATL project, please see the following article in the Microsoft Knowledge Base:

   Article ID: Q173974
   Title     : HOWTO: Add MFC Support to an ATL Project


Additional query words: kbDSSTools
Keywords : WizardIss
Technology : appwizard
Version : WINNT:5.0,5.0sp1,5.0sp2,5.0sp3
Platform : winnt
Issue type : kbprb
Solution Type : kbpending


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: March 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.