Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CoCreateInstance giving problem

CoCreateInstance giving problem

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadmintoolshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shadrach_india
    wrote on last edited by
    #1

    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

    T 1 Reply Last reply
    0
    • S shadrach_india

      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

      T Offline
      T Offline
      tanvon malik
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • T tanvon malik

        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

        S Offline
        S Offline
        shadrach_india
        wrote on last edited by
        #3

        OK. i will change my code and let me see

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups