Page 1 of 1

Sending Messages using Postmessage between two instances.

Posted: 17 Mar 2017, 19:12
by A random guy
So if i have two instances of the same script then how can i (using Postmessage and onmessage) send a message from the second instance to the first instance and not to itself

Re: Sending Messages using Postmessage between two instances.

Posted: 17 Mar 2017, 23:47
by ManualColdLock
Did you try making the script disable OnMessage for a few seconds right before it sends a message?

Re: Sending Messages using Postmessage between two instances.

Posted: 17 Mar 2017, 23:54
by Noesis
Store the scripts hwnd and when getting the window to post to ensure the hwnd of the found window is not the hwnd of the current window before sending (you'll also need the other hwnd, since all other things will be identical you have to use other hwnd as part of the wintitle to send to in the postmessage).

Re: Sending Messages using Postmessage between two instances.

Posted: 18 Mar 2017, 02:07
by lexikos
Use WinGet List to find all instances of your script, or give the two instances different window titles and use the correct one when sending the message.

Re: Sending Messages using Postmessage between two instances.  Topic is solved

Posted: 18 Mar 2017, 09:23
by wolf_II
I already gave code for this in your previous thread: https://autohotkey.com/boards/viewtopic ... 46#p134946

Re: Sending Messages using Postmessage between two instances.

Posted: 18 Mar 2017, 10:33
by A random guy
Oh yeah, sorry didn't read that!