This example describes the method of initializing COM components in C + +. Share to everyone for your reference. Specifically as follows:
Use BCB here
Initialization is required when using components such as Tadoconnect
Call Interface:
CoInitialize (NULL);//Initialize COM suite
couninitialize ();//Free COM Suite
Called in the DLL Portal:
static bool Iscoinitialize = FALSE; is the initialization
int WINAPI DllEntryPoint (hinstance hinst, unsigned long reason, void* lpreserved)
{
if ( Reason==dll_process_attach)
{
if (coninitialize (NULL) = S_OK) Iscoinitialize = true;
}
if (Reason==dll_process_detach)
{
if (iscoinitialize) couninitialize ();
is released by its own initialization, otherwise it is freed by other initialization,
//prevents the wrong release from causing the other caller to fail
} return
1;
I hope this article will help you with the C + + program design.