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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Am I looking at this correctly? [modified]

Am I looking at this correctly? [modified]

Scheduled Pinned Locked Moved COM
questioncomhelptutorialannouncement
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.
  • B Offline
    B Offline
    BubbaGeeNH
    wrote on last edited by
    #1

    This is what I'm trying to do. I'm trying to write a DLL that will give me access to COM components that are available from an Off-The-Shelf product (Sherlock32) so I can get information from it while it is running. I've seen a lot of examples of how to write stand-alone code but I'm lost as to how to handle everything properly. Now if I understand things I can use: #import "c:\sherlock\bin\sp32.exe" named_guids no_namespace in my header file to get access to the CSLID (CSLID_Sherlock) which was put in the exe. Then I can use the following code to get access to the various features. ISherlockPtr m_Sherlock; CoInitialize(NULL); m_Sherlock->CreateInstance(CSLID_Sherlock); m_Sherlock->function; CoUnitialize(); I'm I at least headed in the correct direction? I know I need to add some error checking to make sure the instance was created and the function is returning the correct stuff. One big question I have is should I create the instance once and hold on to it for the length of the use of the DLL or should I create and release it every time I want access to the functions? [Side note: For those of you that are thinking why don't I just put my access code in the program that needs access to Sherlock here is the reason. The DLL is going to be used by a scripting program/language that has DLL capabilities but not COM.] Thanks, George -- modified at 8:54 Friday 5th October, 2007

    B 1 Reply Last reply
    0
    • B BubbaGeeNH

      This is what I'm trying to do. I'm trying to write a DLL that will give me access to COM components that are available from an Off-The-Shelf product (Sherlock32) so I can get information from it while it is running. I've seen a lot of examples of how to write stand-alone code but I'm lost as to how to handle everything properly. Now if I understand things I can use: #import "c:\sherlock\bin\sp32.exe" named_guids no_namespace in my header file to get access to the CSLID (CSLID_Sherlock) which was put in the exe. Then I can use the following code to get access to the various features. ISherlockPtr m_Sherlock; CoInitialize(NULL); m_Sherlock->CreateInstance(CSLID_Sherlock); m_Sherlock->function; CoUnitialize(); I'm I at least headed in the correct direction? I know I need to add some error checking to make sure the instance was created and the function is returning the correct stuff. One big question I have is should I create the instance once and hold on to it for the length of the use of the DLL or should I create and release it every time I want access to the functions? [Side note: For those of you that are thinking why don't I just put my access code in the program that needs access to Sherlock here is the reason. The DLL is going to be used by a scripting program/language that has DLL capabilities but not COM.] Thanks, George -- modified at 8:54 Friday 5th October, 2007

      B Offline
      B Offline
      Baltoro
      wrote on last edited by
      #2

      I had to google Sherlock32 to get an idea of what it was. You provide very little useful information. But, if the executable or DLL that you are interested in is written in a way that it can act as a server for a COM class (this is not a requirement), it has to register its CLSID. Read this: COM Class Objects and CLSIDs[^] The simplest approach is to call: CoCreateInstance[^] Are you doing this in .NET? You gave no clue. -- modified at 19:31 Thursday 4th October, 2007

      B 1 Reply Last reply
      0
      • B Baltoro

        I had to google Sherlock32 to get an idea of what it was. You provide very little useful information. But, if the executable or DLL that you are interested in is written in a way that it can act as a server for a COM class (this is not a requirement), it has to register its CLSID. Read this: COM Class Objects and CLSIDs[^] The simplest approach is to call: CoCreateInstance[^] Are you doing this in .NET? You gave no clue. -- modified at 19:31 Thursday 4th October, 2007

        B Offline
        B Offline
        BubbaGeeNH
        wrote on last edited by
        #3

        Sorry for the lack of information but I was just trying to get a feel for whether my approach is correct and didn't realize you needed more information about Sherlock32. From what I understand about it it does run as a COM server and it has some functions available under its COMM server that should allow me to control it and get information from it. I'll take a look at the things you suggested. I'm using Visual Studio C++ 6.0 to write my code and sticking with C++ & MFC for my coding. They haven't converted over to using .NET at my office yet. Thanks, George

        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