ATL - Raise Event to all clients and acces to same variable
-
I'm working on attributed ATL DLL which establish communication with some hardware. I need to raise event in all clients when hardware signals. Also, I would need to have access to same variable from all clients. This variable actually holds registers from hardware. Can someone point me in right direction how to accomplish this? I have a hardware communication code ready just need to figure out how to rise event in all clients and have them read same register variable. Thank you. Ljube
-
I'm working on attributed ATL DLL which establish communication with some hardware. I need to raise event in all clients when hardware signals. Also, I would need to have access to same variable from all clients. This variable actually holds registers from hardware. Can someone point me in right direction how to accomplish this? I have a hardware communication code ready just need to figure out how to rise event in all clients and have them read same register variable. Thank you. Ljube
Create your class as a singleton, you need to make it an event source, and the consumers an event_receiver - there's an example here on CP As far as the common variable is concerned, you can either pass it byvlaue in the event, or expose it as a property/via a method You'll have to put some locking in the singleton too, to stop your host changing the value while the clients are looking at it
-
Create your class as a singleton, you need to make it an event source, and the consumers an event_receiver - there's an example here on CP As far as the common variable is concerned, you can either pass it byvlaue in the event, or expose it as a property/via a method You'll have to put some locking in the singleton too, to stop your host changing the value while the clients are looking at it