How to prepare code for using COM
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
I have a problem with using COM in my application. For example, I create a simple dialog-based application in VC6 and I want to use COM here. What header files and where do I have to add, may be something I have to change in project settings.
Just make sure you call CoInitialize[Ex] to create a COM apartment and CoUnInitialize to destroy it (before exiting your app). It can do no harm to include comdef.h if you want to use some of the COM helper classes such as _variant_t. Also, you might want to set the _WIN32_DCOM preprocessor directive which will include all the relevant COM headers. Hope that helps...