CoCreateInstance giving problem
-
Hi all i have developed a web server. Whenever a client connect to my web server, i create a thread and process the rquest. In my thread, each time i create one COM component(Script engine vbscript.dll)using CoCreateInstance. so i am facing a problem while calling the CoCreateInstance(). Is any good method to avoid frequent calls to the COM component. I mean one time initializing my engine and using it whenever i need thanks g.shadrach
-
Hi all i have developed a web server. Whenever a client connect to my web server, i create a thread and process the rquest. In my thread, each time i create one COM component(Script engine vbscript.dll)using CoCreateInstance. so i am facing a problem while calling the CoCreateInstance(). Is any good method to avoid frequent calls to the COM component. I mean one time initializing my engine and using it whenever i need thanks g.shadrach
why not use this way
CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF);
hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
pCF->Release();just to call CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF); first time it will ensure the dll loading. then whenever you want to create an instance just call hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
tanvon I Blog here my VC++ My all articles at codeproject here
-
why not use this way
CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF);
hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
pCF->Release();just to call CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF); first time it will ensure the dll loading. then whenever you want to create an instance just call hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
tanvon I Blog here my VC++ My all articles at codeproject here
OK. i will change my code and let me see