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. Connect to external InProc Server ?

Connect to external InProc Server ?

Scheduled Pinned Locked Moved COM
tutorialquestionc++comsysadmin
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.
  • M Offline
    M Offline
    Mark Janveaux
    wrote on last edited by
    #1

    Hi, I want to subscribe to events from an in process ATL COM object. This object is instantiated in a seperate process. I know the code I'm using to generate the events is working properly, but I don't know how to 'grab' the correct instance of the COM component so I can receive these events. If I call CoCreateInstance, I'm creating a new seperate instance of the same object. How do I retrieve the running instance of an inprocess COM object ? Is this possible ? Is there some example code I can look at ? Mark

    J V 2 Replies Last reply
    0
    • M Mark Janveaux

      Hi, I want to subscribe to events from an in process ATL COM object. This object is instantiated in a seperate process. I know the code I'm using to generate the events is working properly, but I don't know how to 'grab' the correct instance of the COM component so I can receive these events. If I call CoCreateInstance, I'm creating a new seperate instance of the same object. How do I retrieve the running instance of an inprocess COM object ? Is this possible ? Is there some example code I can look at ? Mark

      J Offline
      J Offline
      Jawid
      wrote on last edited by
      #2

      I know only one way how to solve your problem here. You have a choise to create an out-of-process COM object and make just a single instance of it in the memory. That means by any calling of CoCreateInstance(..) you connect just to that single instance of your COM object. For creation of a single instance in Visual C++ ATL you can use a macro: DECLARE_CLASSFACTORY_SINGLETON( CMyCass ) Jawid

      1 Reply Last reply
      0
      • M Mark Janveaux

        Hi, I want to subscribe to events from an in process ATL COM object. This object is instantiated in a seperate process. I know the code I'm using to generate the events is working properly, but I don't know how to 'grab' the correct instance of the COM component so I can receive these events. If I call CoCreateInstance, I'm creating a new seperate instance of the same object. How do I retrieve the running instance of an inprocess COM object ? Is this possible ? Is there some example code I can look at ? Mark

        V Offline
        V Offline
        Vi2
        wrote on last edited by
        #3

        Your in-proc object must register yourself in ROT by RegisterActiveObject(). Then any client can retrieve it by GetActiveObject() and subscribe to events. With best wishes, Vita

        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