 |
How to create new component |
FileName |
Description |
Size |
 |
ComNew.zip
| Source code. |
114 kB |
Follow these steps to create new COM component:
- Run Microsoft Visual C++ 6.0 and start new project.
- Select ATL/COM.
- ...

Start new project in Visual C++ 6.0.

Select "ATL COM AppWizard" project type. Enter project name and click OK.

Select "Dynamic Link Library (DLL)" and check "Support MFC" and "Support MTS".

Select class amd Add New ATL Object.

Select MS Transaction Server.

Enter name for ALT object.

Select MTS tab. Check "Support IObjectControl" and "Can be pooled".

Select CComNewLogic.

Change Single to Multi threaded (CComMultiThreadModel) and add comment before DECLARE_NOT_AGGREGATABLE.

Select IComNewLogic.

Enable Transaction Required. Add #include <mtxattr.h>. And TRANSACTION_REQUIRED.

Add new COM Method.

Add new COM Method name and VARIANT parameters as seen on the picture.

Select debug mode and MyTestMethod.

Add code to MyTestMethod.

Build ComNew.dll.

Build ComNew.dll succeeded.

Location of ComNew.dll in File Manager.

Build release version of ComNew.dll.

Set "Use MFC in a Static Library" for release build.