Tuesday, June 29, 2010

Creating A COM DLL USING VC++

Steps for creating a COM DLL using VC++ :

1.Create an ATL Project


File->New->ATL->ATL Project.

Select Support MFC CheckBox (if u want to use MFC classe).
 
2: Add Class

Select Class View.

Add a new Class.

Visual C++ ->ATL->ATL Simple Object.

Enter Class Name.(above slide)

3: Adding Methods to Class


Open Class View.

RightClick the interface (IComInerface).

Add->Add Method.(slide2)

Enter the method name and add all the Parameters for the method.(slide3)

(Note the return type of the method by default ll be HRESULT but parameters can be passed to methods as references, while entering the parameters the appropriate type has to be selected).


 




4: Implement Method:
Open the Com Class file(.cpp) the class that you created .

Find the method you added (slide 4)

write the functionality for the method.
 

........now when u have compiled your code the com dll is created !

No comments:

Post a Comment