0

I am trying to send a simple string message.

In mac I acheived this with setting up a notification observer in my second process, and then from my first process I send a notification string message.

I am trying to acheive this in Windows.

This is how I broadcast the message:

        var data = WCHAR.array()('message from my proc1 yahoo');
        var dataSize = msg.length * msg.constructor.size;

        var cds = COPYDATASTRUCT(null, dataSize, data.address());
        var rezSend = API('BroadcastSystemMessage',
            BSF_FORCEIFHUNG,
            BSM_APPLICATIONS,
            WM_COPYDATA,
            null,
            cds.address()
        );

I'm trying to set up an observer in my second process that can react when it see's this message. How can I set up an observer?

Eryk Sun
  • 33,190
  • 5
  • 92
  • 111
Blagoh
  • 1,225
  • 1
  • 14
  • 29
  • @reuben thank you, I am allowed to inject with ctypes into the processes by means of "Modules" modules are extra add-ins to the software. So I am free to do pretty much anything but I can't edit the core code. – Blagoh Mar 23 '15 at 06:04
  • @reuben I'm trying to broadcast a string message to all messages (like in mac we have objectiveC `postNotification:notificationName:object:userInfo:deliverImmediatey`) and then i want to setup observers in process with my "Module". In mac we can set up observers with `addObserver:selector:name:object`. Thank you for your attention. – Blagoh Mar 23 '15 at 06:09
  • Did you mean to say a "string message to all *messages*"? Did you mean all processes? And are you injecting your modules into processes not running your code? – reuben Mar 23 '15 at 06:13
  • @reuben thanks for that correction, yes string message to all processes. No my module is just in the processes the user selects. I don't inject, but this software allows adding these modules. It's basically like scripting in this software. – Blagoh Mar 23 '15 at 06:15
  • Have you looked at http://stackoverflow.com/questions/5249903/receiving-wm-copydata-in-python?rq=1 ? – reuben Mar 23 '15 at 06:19
  • 3
    Broadcasting `WM_COPYDATA` to all windows in the system is an extremely bad idea, since there are almost certainly other open windows that use that message and will try to interpret your data format as their own. – Jonathan Potter Mar 23 '15 at 07:20
  • Thanks you @JonathanPotter I did not know that. I will abandon this approach and will make another topic asking about other way. – Blagoh Mar 23 '15 at 09:08
  • Thank you folks I have created another topic which is going in a different direction: http://stackoverflow.com/questions/29206555/ipc-equivalent-of-objectivec-postnotification-and-addobserver-in-win32api – Blagoh Mar 23 '15 at 09:18

0 Answers0