ladyvox 发表于 2013-3-25 17:04:47

請教CallDLL !

本帖最后由 ladyvox 于 2013-3-25 17:11 编辑

請問大家我想使用usbuirt.dll 讀寫.

此dll API 文件上讀寫範本為:

UUIRTSetReceiveCallback
UUIRTDRV_API BOOL PASCAL UUIRTSetReceiveCallback(HUUHANDLE hHandle, PUUCALLBACKPROC receiveProc, void *userData);

Registers a receive callback function which the driver will call when an IR code is received from the air. receiveProc should contain the address of a PUUCALLBACKPROC function defined as :
typedef void (WINAPI *PUUCALLBACKPROC) (char *IREventStr, void *userData);
When the USB-UIRT receives a code from the air, it will call the callback function with a null-terminated, twelve-character (like IRMAN) ir code in IREventStr. The driver will also pass the parameter userData, which is a general-purpose 32-bit value supplied by the caller to UUIRTSetReceiveCallback. This parameter is useful for carrying context information, etc. Note that the types of codes which are passed to IREventStr are *not* the same as the type of codes passed back from a UUIRTLearnIR call (the codes from a UUIRTLearnIR are much larger and contain all the necessary data to reproduce a code, whereas the codes passed to IREventStr are simpler representations of IR codes only long enough to be unique).

UUIRTTransmitIR
UUIRTDRV_API BOOL PASCAL UUIRTTransmitIR(HUUHANDLE hHandle, char *IRCode, int codeFormat, int repeatCount, int inactivityWaitTime, HANDLE hEvent, void *reserved0, void *reserved1);

Transmits an IR code via the USB-UIRT hardware. The IR code is a null-terminated *string*. codeFormat is a format specifier which identifies the format of the IRCode code. Currently, supported formats are Compressed_UIRT (STRUCT), RAW, and Pronto-RAW. RepeatCount indicates how many iterations of the code should be sent (in the case of a 2-piece code, the first stream is sent once followed by the second stream sent repeatCount times). InactivityWaitTime is the time in milliseconds since the last received IR activity to wait before sending an IR code -- normally pass 0 for this parameter. hEvent is an optional event handle which is obtained by a call to CreateEvent. If hEvent is NULL, the call to UUIRTTransmitIR will block and not return until the IR code has been fully transmitted to the air. If hEvent is not NULL, it must be a valid Windows event hande. In this case, UUIRTTransmitIR will return immediately and when the IR stream has completed transmission this event will be signalled by the driver. The last parameters, labelled 'reservedx' are for future expansion and should be NULL.

但是均無法使用,關於文件提及HUUHANDLE hHandle要代入哪個參數呢?
傳送我寫為:
$result= DllCall($dll,"int","UUIRTTransmitIR","HANDLE",$hndl,"wstr",$var,"hwnd",0x10,"int",1,"int",0,"int",0,"uint",0,"uint",0)

觀察呼叫時狀況,數值均為0...

Autohotkey 有文件提及傳送寫法為下列方式 :
USBUIRT_SendIRPronto(IRCode,RepeatCount=1)
        {
        hndl := DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTOpen")
        DllCall("C:\WINDOWS\system32\uuirtdrv.dll\UUIRTTransmitIR", UInt,hndl
                , Str, IRCode ; Variable containing IR code to transmit
                , Int, 0x10 ;Codeformat (UUIRT: 0, PRONTO: 0x0010)
                , Int, RepeatCount; Variable containing the number of times to repeat the code.
                , Int, 100; inactivityWaitTime ms
                , Int, 0; HANDLE hEvent to signal code sent
                , UInt, 0, UInt, 0) ; reserved
        }

但如要轉為Autoit ,請問如何改呢?

麻煩大家幫忙!

萬分感謝!
页: [1]
查看完整版本: 請教CallDLL !