StringIPC class - send/receive strings between processes

Post your working scripts, libraries and tools
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

StringIPC class - send/receive strings between processes

26 Jan 2015, 18:29

:!: EDIT: instead of StringIPC class, it's recommended to use ObjRegisterActive, which is more powerful and flexible

StringIPC class allows you to exchange (send/receive) strings between processes. It doesn't use WM_COPYDATA, ClipBoard, FileMapping, COM, Mailslots, Pipes, Sockets, or similar; it's all done via Edit controls in hidden GUIs. ;)

>> Usage preview:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

StringIPC := new StringIPCClass("Alpha")						; Creates "StringIPC" object and defines a name (address) of this process; "Alpha"
StringIPC.SendMessage("Beta", "Please do some stuff for me...") ; Sends a message to "Beta" process with the following text; "Please do some stuff for me..."

>> Download StringIPC.zip which includes; StringIPC class, examples, documentation, license. Run both example scripts (Alpha & Beta) and press F1, F2, 1, 2 hotkeys to start exchanging messages. Press Esc to exit.

>> This short video shows how StringIPC works - what's actually happening in background while processes are exchanging messages.
Image
Last edited by Learning one on 07 Feb 2015, 04:20, edited 2 times in total.
User avatar
joedf
Posts: 6005
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: StringIPC class - send/receive strings between processes

26 Jan 2015, 19:03

Very nice!! :D
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
GitHub: visionary1
Location: Seoul
Contact:

Re: StringIPC class - send/receive strings between processes

27 Jan 2015, 01:52

"It doesn't use WM_COPYDATA, ClipBoard, FileMapping, COM, Mailslots, Pipes, Sockets, or similar; it's all done via Edit controls in hidden GUIs"

Cool..!!
AutoHotkey & AutoHotkey_H v1.1.22.07
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: StringIPC class - send/receive strings between processes

28 Jan 2015, 03:17

Your script seems surprisingly complicated. It doesn't use WM_COPYDATA, but it does use SendMessage/OnMessage plus a Gui and a bunch of Edit controls. It seems to me that using WM_COPYDATA would be simpler; IPC.ahk, for instance.
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: StringIPC class - send/receive strings between processes

28 Jan 2015, 15:50

@lexikos: I absolutely agree that using WM_COPYDATA would be simpler. I know for majkinetor's IPC, and for OnMessage() example in AHK help, which use WM_COPYDATA.

However, one developer told me that I should avoid using WM_COPYDATA to exchange strings between processes. I also read about possible problems when using WM_COPYDATA (it was long itme ago, can't remember where). So that's the only reason I wrote this… Do you think that using WM_COPYDATA is reliable? Do you recommend it for sending strings between processes?

@joedf, Soft: Thx :)
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: StringIPC class - send/receive strings between processes

28 Jan 2015, 18:40

I am not aware of any issues with WM_COPYDATA. What have you heard?

Actually, there's a much more flexible and fairly simple IPC method available with v1.1.17+. I intend to post about it later, when I get more time.
User avatar
boiler
Posts: 2000
Joined: 21 Dec 2014, 02:44

Re: StringIPC class - send/receive strings between processes

28 Jan 2015, 23:48

lexikos wrote:Actually, there's a much more flexible and fairly simple IPC method available with v1.1.17+. I intend to post about it later, when I get more time.


Looking forward to this. Right now I clumsily do IPC via text file. I wasn't aware of IPC.ahk, but I guess now I'll just wait for the update.
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: StringIPC class - send/receive strings between processes

29 Jan 2015, 03:24

ObjRegisterActive demonstrates the other IPC method I was referring to.
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: StringIPC class - send/receive strings between processes

29 Jan 2015, 15:24

@lexikos: That developer only said that I should avoid using it, and I didn't ask for details... :(
Wow, ObjRegisterActive rocks! 8-) With such a powerful and flexible IPC method it really doesn't make sense to use StringIPC.
Thank you for making & presenting ObjRegisterActive! :)
First post updated.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: fischgeek and 12 guests