Code: Select all
#NoEnv
#SingleInstance force
#Persistent
; Return this script's hidden hwdn id. +0 to convert from Hex to Dec
ownHwnd := A_ScriptHwnd + 0
xyScript =
( LTrim Join
::<things to do in that instance>;
)
Send_WM_COPYDATA(xyScript)
return
Send_WM_COPYDATA(message)
{
global xyHwnd
if WinExist("ahk_id" . xyHwnd") {
size := StrLen(message)
if !(A_IsUnicode) {
VarSetCapacity(data, size * 2, 0)
StrPut(message, &data, "UTF-16")
} else {
data := message
}
VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
NumPut(4194305, COPYDATA, 0, "Ptr")
NumPut(size * 2, COPYDATA, A_PtrSize, "UInt")
NumPut(&data, COPYDATA, A_PtrSize * 2, "Ptr")
result := DllCall("User32.dll\SendMessageW", "Ptr", xyHwnd, "UInt", 74, "Ptr", 0, "Ptr", ©DATA, "Ptr")
}
return
}
Ofc you need a Receive_WM_COPYDATA() function as well to get the hwnd from xyplorer (invoke it once with a command line parameter to send back its hwnd to ownHwnd)...