回复 4# 绿色风 #PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#include <PassThruFunc.au3>
Local $CAN = 0X05
Local $CAN_ID_BOTH = 0X00000400
Local $id = 3
Local $result = PassThruOpen(Null, $id)
MsgBox(0, "222", $id)
Local $ChannelID
Local $baudrate = 9600
Local $connect = PassThruConnect($id, $CAN, $CAN_ID_BOTH, $baudrate, $ChannelID)
MsgBox(65536, "CHANid", $ChannelID)
这是文件2
;----------------------------------------------------------------------Func PassThruConnect($DeviceId, $ProtocolID, $Flags, $BaudRate, ByRef $ChannelID)
Local $_cChannelID = DllStructCreate("ulong")
Local $pChannelID = DllStructGetPtr($_cChannelID)
Local $ReConnect = DllCall($OpenDll, "int", "PassThruConnect", _
"ulong", $DeviceId, _
"ulong", $ProtocolID, _
"ulong", $Flags, _
"ulong", $BaudRate, _
"ulong_ptr", $pChannelID)
If @error Then
MsgBox(65536, "PassThruConnect", "Error Code :" & @error)
Else
$ChannelID = DllStructGetData($_cChannelID, 1)
Return $ReConnect[0]
EndIf
EndFunc
这是文件1里的函数C |