Or from the RR source:
Code:
Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
Global Const $WM_COPYDATA = 0x4A
Global Const $WM_CLOSE = 0x10
Global Const $STRUCTDEF_AU3MESSAGE = "char[255]"
Dim $cmd
; Create Reciver window
$hwmd_Reciver = GUICreate("Receiver")
; Register Windows Messages
GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")
;Loop indefinitely - put your commands in here
While 1
If $cmd = "this" Then
$cmd = ""
<do this>
Endif
If $cmd = "that" Then
$cmd = ""
<do that>
Endif
Sleep(250)
WEnd
; Message Handler
Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam)
If $MsgID = $WM_COPYDATA Then
; We Recived a WM_COPYDATA Message
; $LParam = Poiter to a COPYDATA Struct
$vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam)
; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct
$vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3))
$SciTECmdLen = DllStructGetData($vs_cds, 2)
$cmd = StringLeft(DllStructGetData($vs_msg, 1), $SciTECmdLen)
; Display what we have recived
MsgBox(0, "Test String", $cmd)
ElseIf $MsgID = $WM_CLOSE Then
; We Recived a WM_CLOSE Message
Exit
EndIf
EndFunc ;==>_GUIRegisterMsgProc
Once the script is running, you can send commands to it from RR via "SENDMSG;Receiver;<cmd>"
In this example, <cmd> can be "this" or "that."
*Note the the "Receiver" name has to match
Sonic's way is good too. I prefer the method above as it's more process friendly for my M10K since it just sleeps until a message is recieved.
Bookmarks