Can anybody suggest a link which provide step by step COM Class creation??

Can anybody suggest a link which provide step by step COM Class creation??
would be better if it explains with VS2010

Many thanks in advance
Don't do it manually (unless you have no alternative). Do you have access to ATL and the VS Wizard that creates ATL COM objects?
Thanks for your reply...

Yes I am using wizard only in VS2010, As I am newly learning COM technology. I am using wizard but getting some error at very initially about some macro. Just want to know what are ideal steps have to keep in mind while creating any COM application like...
1.Create interfaces.
2.Create class and implement those interfaces
3.Create Class factory class.
3.Register that component.
4. How client can access that functinality and so on...
I have read theory but want to know how practically does it work ...

Any link which provides any valuable information or you know some steps which need to fallow while creating COM then also welcome

Many thanks
Are you using ATL? Using COM is a miserable affair, but ATL makes the experience tolerable. The reason is COM is about dynamic binding, whereas C++ is about static binding. ATL uses templates to handle common code and provide a reasonable interface. If you have it, use it. If you don't, get it.

The ATL Wizard will create all the stuff you need and all you to add methods later. Whether you use a Factory or not isn't an ATL or Wizard issue. Don't create one if you don't need one.

Don't confuse the ATL Wizard with the MFC COM Wizard.
For a simple COM/ATL DLL

A Beginner Tutorial for Writing Simple COM/ATL DLL For VS2012
http://www.codeproject.com/Articles/505791/A-Beginner-Tutorial-for-Writing-Simple-COM-ATL-DLL

for a basic ActiveX control you can embed in a web page

ATL Tutorial
http://msdn.microsoft.com/en-us/library/599w5e7x%28v=vs.110%29.aspx

Andy

Also see:

ATL Concepts
http://msdn.microsoft.com/en-us/library/3ax346b7%28v=vs.110%29.aspx
Thank you Andy
Hello Andy!

I tried to follow steps which are mentioned in first link but there are some macros generated and compiler reporting error for the same.
I have followed first 7 steps and trying to compile.

error like in dllmain.h file



// dllmain.h : Declaration of module class.

class CsimpleATLCom_A1Module : public ATL::CAtlDllModuleT< CsimpleATLCom_A1Module >
{
public :
DECLARE_LIBID(LIBID_simpleATLCom_A1Lib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_SIMPLEATLCOM_A1, "{EB32FCD0-D2CC-4B61-8CB8-04C6A96E3CDB}")
};

extern class CsimpleATLCom_A1Module _AtlModule;

error description like...

Error 1 error C2065: 'LIBID_simpleATLCom_A1Lib' : undeclared identifier c:\ajit data\com_pract\simpleatlcom_a1\simpleatlcom_a1\dllmain.h 6

not understanding this error

I am using vs2010

The LIBID is whatever the names is you used in the idl file. The example they give in the CodeProject.com tutorial is

library SimpleATLComLib

so it ends up as LIBID_SimpleATLComLib

But you can check the .h file generated from the idl file to confirm this.

Andy
Topic archived. No new replies allowed.