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. ATL / WTL / STL
  4. catching events

catching events

Scheduled Pinned Locked Moved ATL / WTL / STL
questionc++
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.
  • D Offline
    D Offline
    dudic
    wrote on last edited by
    #1

    I create ATL component with a number of methods. Some of them run perform long operations, and I need send to client application status of this. How do I have to add event to my ATL and listen it in a client application ?

    L T 2 Replies Last reply
    0
    • D dudic

      I create ATL component with a number of methods. Some of them run perform long operations, and I need send to client application status of this. How do I have to add event to my ATL and listen it in a client application ?

      L Offline
      L Offline
      Lim Bio Liong
      wrote on last edited by
      #2

      Hello Dudic, My advise is to create a separate thread in your COM Object to perform the long operations. As and when a change in status occurs in your COM object, you fire an event to your client app. There are several points you need to note about achieving the above mentioned design : 1. Your thread must be a COM thread. That is, it must call CoInitialize() on start up and call CoUninitialize() just before termination. 2. The event handler interface pointer of your client (which are passed to you when your client connects with your COM Object's connection points) must be marshalled to your COM Object. They -CANNOT- be passed to your thread by simple copying. I'm going to write an article on COM threading soon and I'll keep you posted when I do. Best Regards, Bio.

      1 Reply Last reply
      0
      • D dudic

        I create ATL component with a number of methods. Some of them run perform long operations, and I need send to client application status of this. How do I have to add event to my ATL and listen it in a client application ?

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        dudic wrote: I create ATL component with a number of methods. Some of them run perform long operations, and I need send to client application status of this. How do I have to add event to my ATL and listen it in a client application ? yeah Buddy, you have to implement IConnectionPoint Interface in you class to raise event. Follow these step-> 1.add a simpleATL object using Insert|newATlobject chose Simple Object and press NEXT you find the Property Sheet there #1 property sheet for name Give the name to you object say ObjectEvent. #2 Attribute Check the boc for IConnectionPoint interface. then press ok. you will see two interface for your class interface ObjectEvent dispinterface _IObjectEvent add method in _IObjectEvent thorough class wizard. like void MyEvent(); and implement this Connection point in the iObjectEvnt Interface. you can get option by right clicking on class of interface. and for notifying other user about event you got the Event in you Interface class like this FIRE_MyEvent() and by calling this function you can fire event that can be handle by clientapplication. dudic wrote: listen it in a client application sorry i don't have any knowledge about how to handle event in VC++ based application ,because i used to test application with VB. i hope any good programmer will help you in this matter ----------------------------- "I Think It Will Help" ----------------------------- Alok Gupta visit me at http://www.thisisalok.tk

        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