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. COM event firing to multiple targets

COM event firing to multiple targets

Scheduled Pinned Locked Moved COM
c++comquestion
4 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.
  • E Offline
    E Offline
    eero_p
    wrote on last edited by
    #1

    Creating a COM dll -module that fires events is simple enough (ATL -project -> add ATL simple object with Connection point -support -> Add a couple methods etc.), but: What flags are needed for multiple instances to catch the same event when it is fired? I.e. when I CoCreateInstanceEx a connection to module from let's say 2 separate exe's, both can receive the same event. Tried quite a few combinations so far and yet no success.

    H 1 Reply Last reply
    0
    • E eero_p

      Creating a COM dll -module that fires events is simple enough (ATL -project -> add ATL simple object with Connection point -support -> Add a couple methods etc.), but: What flags are needed for multiple instances to catch the same event when it is fired? I.e. when I CoCreateInstanceEx a connection to module from let's say 2 separate exe's, both can receive the same event. Tried quite a few combinations so far and yet no success.

      H Offline
      H Offline
      Hubert Mayer
      wrote on last edited by
      #2

      You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings

      R E 2 Replies Last reply
      0
      • H Hubert Mayer

        You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings

        R Offline
        R Offline
        Rajasekharan Vengalil
        wrote on last edited by
        #3

        Even with singleton COM objects if it is an in-process component then you'd still get separate notifications from multiple EXE clients. You would either have to make the component out-process or CoCreateInstance it from one EXE and load it up into the Running Object Table (ROT) using RegisterActiveObject and grab a reference to it from the second EXE using GetActiveObject.

        -- gleat http://blogorama.nerdworks.in[^] --

        1 Reply Last reply
        0
        • H Hubert Mayer

          You need another Class Factory. Use the DECLARE_CLASSFACTORY_SINGLETON macro. In this case all COM-clients get the same instance. In this case your COM-Object must be threadsafe ! Greetings

          E Offline
          E Offline
          eero_p
          wrote on last edited by
          #4

          That did the trick. Thanks a lot!

          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