Bewerken

Delen via


Details of ATL Support Added by the ATL Wizard

When you add ATL support to an existing MFC executable or DLL, Visual Studio adds a header file called framework.h by default, which contains #include and #define preprocessor directives to enable the use of ATL in your project. No additional files or classes are added, as was done in previous versions of Visual Studio.

When you add ATL support to an existing MFC executable or DLL, Visual Studio makes the following modifications to the existing MFC project (in this example, the project is called MFCEXE):

  • Two new files (an .idl file and an .rgs file, used to register the server) are added.

  • In the main application header and implementation files (Mfcexe.h and Mfcexe.cpp), a new class (derived from CAtlMFCModule) is added. In addition to the new class, code is added to InitInstance for registration. Code is also added to the ExitInstance function for revoking the class object. In the header file, Finally, two new header files (Initguid.h and Mfcexe_i.c) are included in the implementation file, declaring and initializing the new GUIDs for the CAtlMFCModule-derived class.

  • To register the server properly, an entry for the new .rgs file is added to the project's resource file.

Notes for DLL Projects

When you add ATL support to an MFC DLL project, you will see some differences. Code is added to the DLLRegisterServer and DLLUnregisterServer functions for registering and unregistering the DLL. Code is also added to DllCanUnloadNow and DllGetClassObject.

See also

ATL Support in an MFC Project
Adding Functionality with Code Wizards
Adding a Class
Adding a Member Function
Adding a Member Variable
Overriding a Virtual Function
MFC Message Handler
Navigating the Class Structure