IPC

Inter-Process Communication.

An AHK script or DotNet application can use this module to send text or binary data to another AHK script or DotNet application using WM_COPYDATA message.  AHK module is implemented in IPC.ahk.  DotNet library is implemented in IPC.cs.  API is the same up to the language differences.

Summary
IPCInter-Process Communication.
SendSend the message to another process (receiver).
SetHandlerSet the data handler.
About

Send

IPC_Send(Hwnd,  
Data = "",
Port = 100,
DataSize = "")

Send the message to another process (receiver).

Parameters

HwndHandle of the receiver.
DataData to be sent, by default empty.  Optional.
PortPort, by default 100.  Positive integer.  Optional.
DataSizeIf this parameter is used, Data contains pointer to the buffer holding binary data.  Omit this parameter to send textual messages to the receiver.

Remarks

The data being passed must not contain pointers or other references to objects not accessible to the script receiving the data.  While this message is being sent, the referenced data must not be changed by another thread of the sending process.  The receiving script should consider the data read-only.  The receiving script should not free the memory referenced by Data parameter.  If the receiving script must access the data after function returns, it must copy the data into a local buffer.

This function uses Gui +Lastfound to obtain the handle of the sender.

Returns

Returns TRUE if message was or FALSE if sending failed.  Error message is returned on invalid usage.

SetHandler

IPC_SetHandler(Handler)

Set the data handler.

Parameters

HandlerFunction that will be called when data is received.

Handler

Handler(Hwnd, Data, Port, DataSize)
HwndHandle of the window passing data.
DataData that is received.
PortData port.
DataSizeIf DataSize is not empty, Data is pointer to the actuall data.  Otherwise Data is textual message.

About

IPC_Send(Hwnd,  
Data = "",
Port = 100,
DataSize = "")
Send the message to another process (receiver).
IPC_SetHandler(Handler)
Set the data handler.
Close