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. COM
  4. Query a specific COM DLL for an interface

Query a specific COM DLL for an interface

Scheduled Pinned Locked Moved COM
databasecomtutorialquestion
5 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.
  • M Offline
    M Offline
    Martin Eskildsen
    wrote on last edited by
    #1

    Hi, Can anybody tell me how to find out if a COM DLL has implemented a specific interface. All I know is the name of the DLL and the CLSID of the interface. I gues Microsfot is doing something similar when they implements add-ins to both Developer Studio and office? Martin Eskildsen

    M 1 Reply Last reply
    0
    • M Martin Eskildsen

      Hi, Can anybody tell me how to find out if a COM DLL has implemented a specific interface. All I know is the name of the DLL and the CLSID of the interface. I gues Microsfot is doing something similar when they implements add-ins to both Developer Studio and office? Martin Eskildsen

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      This is what QueryInterface() does. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

      M 1 Reply Last reply
      0
      • M Michael Dunn

        This is what QueryInterface() does. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

        M Offline
        M Offline
        Martin Eskildsen
        wrote on last edited by
        #3

        Ok - I also thought about QueryInterface in the first place, both I can't figure out how to use it on a spefic DLL (only given the filename of a COM DLL to query the specific DLL wheter it supports the requested interface since). A short example might make my question more clear: I have an executable (MyProg.exe) and two COM DLL's (MyDllA.dll and MyDllB.dll). Both Dll's is allowed to support the requested interface (like add-ins in Developer Studio). In this sample both DLL's supports the interface called IMyInterface, with CLSID CLSID_MyInterface. How can I use QueryInterface in combination with the information above to verify that both DLL's support the interface IMyInterface? Martin Eskildsen

        M 1 Reply Last reply
        0
        • M Martin Eskildsen

          Ok - I also thought about QueryInterface in the first place, both I can't figure out how to use it on a spefic DLL (only given the filename of a COM DLL to query the specific DLL wheter it supports the requested interface since). A short example might make my question more clear: I have an executable (MyProg.exe) and two COM DLL's (MyDllA.dll and MyDllB.dll). Both Dll's is allowed to support the requested interface (like add-ins in Developer Studio). In this sample both DLL's supports the interface called IMyInterface, with CLSID CLSID_MyInterface. How can I use QueryInterface in combination with the information above to verify that both DLL's support the interface IMyInterface? Martin Eskildsen

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          You're confusing DLLs vs. COM servers, and CLSIDs vs. IIDs. First, when creating a COM object, you reference the server by its CLSID, not its filename. CoCreateInstance() takes the CLSID. You also can request an interface in CoCreateInstance(). So if you have the CLSID of one of the servers, and the IID they support (say IID_IMyInterface) you pass both of those to CoCreateInstance() and check the return value to see if it succeeded. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

          F 1 Reply Last reply
          0
          • M Michael Dunn

            You're confusing DLLs vs. COM servers, and CLSIDs vs. IIDs. First, when creating a COM object, you reference the server by its CLSID, not its filename. CoCreateInstance() takes the CLSID. You also can request an interface in CoCreateInstance(). So if you have the CLSID of one of the servers, and the IID they support (say IID_IMyInterface) you pass both of those to CoCreateInstance() and check the return value to see if it succeeded. --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.

            F Offline
            F Offline
            Felix Cho
            wrote on last edited by
            #5

            In the event that the CLSID of the CoClass object is not known, you can: - use the COM category manager (ICatInformation) and enumerate the objects' CLSIDs at runtime - do category management under your own registry key(s), basically you store the list of COM object CLSIDs and you call CoCreateInstance() on those CLSID and get your interface using QueryInterface() after that

            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