0

In Visual Studio, how do I write a COM object from scratch? There does not seem to be a new project option for a com object.

2 Answers 2

1

You have to go to Other Languages -> Visual C++ -> ATL Project to write a COM object.

Sign up to request clarification or add additional context in comments.

4 Comments

ATL == active template library. Are all com objects written this way?
Are all COM objects bascailly DLL's and the technology of COM is actually what code resides in the DLL that makes it a COM object?
COM objects are just DLL's that expose a specific interface. Namely IUnknown. Be aware that there ARE ways of creating managed assemblies that expose these interfaces and allow COM clients to talk to them.
ATL simplifies COM development quite a lot. Lots of boiler plate code is hidden in templates and macros. It is however not the easiest of tasks. You should get a book on the subject, as COM defines a set of scenarios and rules, under which your COM objects may run. ATL or not, you need to know these rules. As for doing it in .NET, it will be simpler, but you will get a dependency on the .NET framework, which may or may not be acceptable according to your requirements.
1

Xarzu - It would be helpful to know what you're looking to do. If you're looking to build a component that can take advantage of Windows server features such as transactions, object pooling, security or queuing services, you can get by with a COM+ application (which would be written as a C# library application).

If you're diving deeper and not leveraging Windows enterprise services, you're going to be dealing with Visual C++, as Aamir mentioned.

Just wanted to make sure that the right question is getting answered for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.