Показать сообщение отдельно
Старый 29.03.2011, 10:25   #2197
pierrotm777
Старший Пользователь
 
Аватар для pierrotm777
 
Регистрация: 07.11.2010
Регион: другой - для добавления сообщить ab
Сообщений: 324
pierrotm777 is just really nicepierrotm777 is just really nicepierrotm777 is just really nicepierrotm777 is just really nice
Smile Exemple

You can use this exemple if you want use the copydata :

Код:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=receiver.exe
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WindowsConstants.au3>
#Include <misc.au3>

;*******************************How to use this script****************************************
;1- Run this script
;2- Create a .skin with two buttons
;3- For each button, use the RR command "SENDMSG;NameOfYourScript;CMD1"

;*****************************************connexion à RR**************************************
Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
;Global Const $WM_COPYDATA = 0x4A
;Global Const $WM_CLOSE = 0x10
Global Const $STRUCTDEF_AU3MESSAGE = "char[255]"

_Singleton(@ScriptName)

Global $FrontEndName
If ProcessExists("RideRunner.exe") Then
	$FrontEndName = "RideRunner.exe"
ElseIf ProcessExists("iCarDS.exe") Then
	$FrontEndName = "iCarDS.exe"
EndIf


;create SDK for COM with RR.  This must be done ONLY once per script
$rr = "NIL"
$F = WinExists("RoadRunner")
If $F = 0 Then MsgBox(0, "Error", "Need a RideRunner" & @CRLF & _
			"process to run !!!", 5)
If $F = 1 Then
    $rr = ObjCreate("RideRunner.SDK")
EndIf

$rr.execute("SETTOPMOST;RR;false")

If @error Then
    MsgBox(4096, "Error", "An error it is produced")
EndIf

; Create Reciver window
$hwmd_Reciver = GUICreate("NameOfYourScript")

; Register Windows Messages
GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")


Dim $cmd

While 1
	If $cmd = "CMD1" Then; you can change CMD1 by the command you want made
	  $cmd = ""
		;your code if CMD1 is send by DS or RR
		MsgBox(0,"Info","The button CMD1 is used !")
		$rr.execute("VIDEO")
	EndIf

	If $cmd = "CMD2" Then; you can change CMD2 by the command you want made
	  $cmd = ""
		;your code if CMD2 is send by DS or RR
		MsgBox(0,"Info","The button CMD2 is used !")
		$rr.execute("RADIO")
	EndIf

	If not ProcessExists($FrontEndName) Then
		Exit
	EndIf
	Sleep(250)
Wend

;**********************************************connexion à RR*************************************************
;*************************************************************************************************************

; 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

Код:
;*******************************How to use this script****************************************
;1- Run this script
;2- Create a .skin with two buttons
;3- For each button, use the RR command "SENDMSG;NameOfYourScript;CMD1"
pierrotm777 вне форума   Ответить с цитированием