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. Visual Basic
  4. Tricky!! VB.NET counterpart of CLSIDFromProgID and CoCreateInstance

Tricky!! VB.NET counterpart of CLSIDFromProgID and CoCreateInstance

Scheduled Pinned Locked Moved Visual Basic
questioncsharpc++com
4 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
    Stephan Pilz
    wrote on last edited by
    #1

    Hello, I have some (more than once) COM-Servers (in different DLL's) and each of them implements the same Interface. Only what I know is the InterfaceName and the ProgID of the COM-Server. How can I instanciate a COM-Object in VB.NET with this informations? I C/C++ it looks like:

    HRESULT hr = CLSIDFromProgID (ProgID), &clsid);
    hr = CoCreateInstance (clsid, NULL, CLSCTX_INPROC_SERVER, IID_IInterfaceName, (void **) &m_pCOMSmartPtr);
    
                   \\\\\\|///
                 \\\\  - -  //
                  (  @ @  )
    

    +---------------oOOo-(_)-oOOo-----------------+
    | Stephan Pilz stephan.pilz@stephan-pilz.de |
    | www.stephan-pilz.de |
    | ICQ#: 127823481 |
    +-----------------------Oooo------------------+
    oooO ( )
    ( ) ) /
    \ ( (_/
    \_)

    D 1 Reply Last reply
    0
    • S Stephan Pilz

      Hello, I have some (more than once) COM-Servers (in different DLL's) and each of them implements the same Interface. Only what I know is the InterfaceName and the ProgID of the COM-Server. How can I instanciate a COM-Object in VB.NET with this informations? I C/C++ it looks like:

      HRESULT hr = CLSIDFromProgID (ProgID), &clsid);
      hr = CoCreateInstance (clsid, NULL, CLSCTX_INPROC_SERVER, IID_IInterfaceName, (void **) &m_pCOMSmartPtr);
      
                     \\\\\\|///
                   \\\\  - -  //
                    (  @ @  )
      

      +---------------oOOo-(_)-oOOo-----------------+
      | Stephan Pilz stephan.pilz@stephan-pilz.de |
      | www.stephan-pilz.de |
      | ICQ#: 127823481 |
      +-----------------------Oooo------------------+
      oooO ( )
      ( ) ) /
      \ ( (_/
      \_)

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Does something like this work for you?

      Dim t As Type = Type.GetTypeFromProgID("_progID_")
      Dim retVal As Object
      retVal = Activator.CreateInstance(t)
      

      Dave Kreskowiak Microsoft MVP - Visual Basic

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Does something like this work for you?

        Dim t As Type = Type.GetTypeFromProgID("_progID_")
        Dim retVal As Object
        retVal = Activator.CreateInstance(t)
        

        Dave Kreskowiak Microsoft MVP - Visual Basic

        S Offline
        S Offline
        Stephan Pilz
        wrote on last edited by
        #3

        Hello Dave, Yes this works fine. Thank you. Regards Stephan

                       \\\\\\|///
                     \\\\  - -  //
                      (  @ @  )
        

        +---------------oOOo-(_)-oOOo-----------------+
        | Stephan Pilz stephan.pilz@stephan-pilz.de |
        | www.stephan-pilz.de |
        | ICQ#: 127823481 |
        +-----------------------Oooo------------------+
        oooO ( )
        ( ) ) /
        \ ( (_/
        \_)

        D 1 Reply Last reply
        0
        • S Stephan Pilz

          Hello Dave, Yes this works fine. Thank you. Regards Stephan

                         \\\\\\|///
                       \\\\  - -  //
                        (  @ @  )
          

          +---------------oOOo-(_)-oOOo-----------------+
          | Stephan Pilz stephan.pilz@stephan-pilz.de |
          | www.stephan-pilz.de |
          | ICQ#: 127823481 |
          +-----------------------Oooo------------------+
          oooO ( )
          ( ) ) /
          \ ( (_/
          \_)

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No problem! :-D

          Dave Kreskowiak Microsoft MVP - Visual Basic

          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