Using the ATL COM AppWizard
To create a project using the ATL COM AppWizard
-
Open Visual C++. Click New on the File menu and click the Projects tab.
-
Choose ATL COM AppWizard as your application type.
-
Enter a project name.
-
Click OK.
The ATL COM AppWizard displays a dialog box showing options that apply to your ATL project:
-
Choose from one of three server types: Dynamic Link Library (DLL) for an in-process server, Executable (EXE) for a local out-of-process server, or Service (EXE), which is a Windows NT application that runs in the background when NT starts up.
-
Select the Allow merging of proxy/stub code check box as a convenience when marshaling interfaces is required. This option places the MIDL generated proxy and stub code in the same DLL as the server.
-
Select the Support MFC check box (available for DLL projects only) to use MFC functionality (such as CString) in your server.
-
Select the Support MTS check box to modify the project build settings to support the Microsoft Transaction Server. For more information on adding MTS support to your project, see MTS Support in ATL Projects.
Click Finish to generate the project. The AppWizard then displays information about the project that it is creating and then displays the newly created project in the Project Workspace.
Note When you build your project, you can choose a MinSize or MinDependency configuration. MinSize will generate a smaller component, since shared code will be used from Atl.dll. In this case, you must distribute Atl.dll with your component. MinDependency will generate a larger component, since all necessary code will be linked in with your component.
Note When building a Release version of a project, you can get the following link error:
LIBCMT.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
This error occurs if you are using CRT functions that require CRT startup code. The Release configurations define _ATL_MIN_CRT, which excludes CRT startup code from your EXE or DLL. To avoid this error, do one of the following:
-
Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. On the Project menu, click Settings. In the Settings For: drop-down list, choose Multiple Configurations. In the Select project configuration(s) to modify dialog box that appears, click the check boxes for all Release versions, and then click OK. On the C/C++ tab, choose the General category, then remove _ATL_MIN_CRT from the Preprocessor definitions edit box.
-
If possible, remove calls to CRT functions that require CRT startup code and use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions.