Microsoft KB Archive/199682

= PRB: ATL Object Wizard Cannot Add ATL Object to Existing File =

Article ID: 199682

Article Last Modified on 10/24/2003

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition

-



This article was previously published under Q199682



SYMPTOMS
If you try to insert an ATL Object Wizard object into an existing .h or .cpp file, you get the following error message:

The file {filename} already exists. The Object Wizard requires a new file. Please enter another filename.



CAUSE
The ATL Object Wizard is not designed to insert objects into existing files. You need to provide a new file name for the .h and .cpp files.



RESOLUTION
This is by design.



STATUS
NOTE: Microsoft Visual C++ version 6.0 does not have this limitation.



Steps to Reproduce

 * 1) Create a new ATL COM AppWizard project using default options.
 * 2) On the Insert menu, click New ATL Object.
 * 3) Click Simple Object and then click Next.
 * 4) In the ATL Object Wizard Properties dialog box, click the Names tab.
 * 5) In the Short Name edit box, type obj1, and click OK.

This creates Obj1.h and Obj1.cpp files in the project directory.
 * 1) Repeat steps 2 to 4 above.
 * 2) In the Short Name edit box, type obj2.
 * 3) Change .H Name from Obj2.h to Obj1.h or .CPP Name from Obj2.cpp to Obj1.cpp. Click OK.

RESULTS: You should get the error message:

The file obj1.h already exists. The Object Wizard requires a new file. Please enter another filename.

Keywords: kbide kbprb kbwizard KB199682

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.