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. COM
  3. How does a Client know if there is a COM server that belongs to it

How does a Client know if there is a COM server that belongs to it

Scheduled Pinned Locked Moved COM
3 Posts 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    HI I was wondering how a Client can see if a COM server that belongs to him exists in the registry. If an server exists I would like to add an item in the Client's menu. Thank you for your time.

    K B 2 Replies Last reply
    0
    • L Lost User

      HI I was wondering how a Client can see if a COM server that belongs to him exists in the registry. If an server exists I would like to add an item in the Client's menu. Thank you for your time.

      K Offline
      K Offline
      Keith Hill
      wrote on last edited by
      #2

      First you need to know either the CLSID or the ProgID of the server. If you know the CLSID then convert the CLSID to a string using StringFromCLSID. Then attempt to open the following registry key: HKEY_CLASSES_ROOT\CLSID\"Your server's CLSID as a string" If the key exists then the server has been installed on this machine. If you have the ProgID, you can use CLSIDFromProgID() to get the CLSID and then proceed as indicated above. The other option, is to use CoCreateInstance() to see if you can actually create the object and then shut it down. However, that might affect performance of your app unacceptably.

      1 Reply Last reply
      0
      • L Lost User

        HI I was wondering how a Client can see if a COM server that belongs to him exists in the registry. If an server exists I would like to add an item in the Client's menu. Thank you for your time.

        B Offline
        B Offline
        Brian Hart
        wrote on last edited by
        #3

        Call CoGetClassObject() and test to see if it fails with the REGDB_E_CLASSNOTREG error: IClassFactory* pCF = NULL; HRESULT hResult = CoGetClassObject(CLSID_TheObject, NULL, CLSCTX_WHATEVER_YOU_WANT_TO_USE, (void**)&pCF); if (FAILED(hResult)) { if (hResult == REGDB_E_CLASSNOTREG) { // the server's not registered properly... } }

        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