0
votes

So, I'm creating an ATL project in visual studio 2008 using the wizard (recommended here - How to create ActiveX DLL in Visual C++ - and elsewhere)

But I can't add any classes to my project. VS returns the following error:

atl classes can only be added to mfc exe and mfc regular dll projects or projects with full atl support

...the latter of which you'd think an atl project would have, right?

Can anyone offer a fix?

(I've tried both ticking and unticking 'Support COM+ 1.0' when creating the project - I'm not quite sure what to do with this option).

4
You may also verify setting in the project Configuration Properties - General - Use of ATL should be static or dynamic linkjszpilewski

4 Answers

2
votes

Add "new item..." instead of Add "class...". Then you can select one of the ATL options.

0
votes

Interesting that your link: "How to create ActiveX DLL in Visual C++" doesn't have any information about creating ATL project :)

Anyway: File - New - Project - ATL - ATL Project - Next - Next - Finish. ATL project is ready.

Project - Add Class - ATL - ATL Simple Object - Add - Fill class name - Finish. ATL class is added.

0
votes

I discovered this thread on msdn and tried all suggested solutions. The only one that worked was identifying 'isAtlProject()' in the javascript and setting it to return true. That got me to the next dialog.

However, having created the class, the 'Add Method' wizard would then silently fail to add all of the required code to the interface, header and cpp files. I made another thread about this. Turns out the reason for the latter bug was that intellisense was manually disabled (see other thread for details) :- to anyone reading this in future with the same problem, if you fix intellisense first maybe you won't have to bodge the javascript? Give it a go at least!

0
votes

If you did not create project as "ATL Project". Make sure atlbase.h is included in stdafx.h then Add .cpp file (any name) to your project with the following code:

// ATLMod.cpp 
/* This is all that is needed to satisfy VS full ATL support requirement
   when adding  ATL items with the wizards.
   Just has to be present in the project.  Compilation not required.
   Can set "Exclude from build" property to Yes.
*/

#include "stdafx.h"

// ATLMod.h : Declaration of copy of DllMain.h
class CATLProject1Module : public ATL::CAtlDllModuleT< CATLProject1Module >
{
public:
} _AtlModule;