Jump to content

Please help me! CallDll.


Recommended Posts

I want to use IR device with usb-uirt.

I have read the USB-UIRT API documentation,and can be use UUIRTGetDrvVersion.

But I don't know how to use Transmit and Receive.

I try this code...

$result= DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0)

But read array value always is 0.

Found Call uuirtdrv.dll founction List:

1.Receiver : UUIRTSetReceiveCallback

2.Send : UUIRTTransmitIR

USBUirt Dll API documentation

http://ccnicolas.free.fr/domotique/apiuirt.htm

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.

Attached is dll file.

Everybody Please help me.

Thank!

uuirtdrv.7z

Edited by ericli03
Link to comment
Share on other sites

Sorry ,

How do I know "HUUHANDLE hHandle"

In Autohotkey :

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Transmit an IR code for PRONTO.

; Added the ability to define the number of times to repeat the code as multiple repeats are required

; by some items.

USBUIRT_SendIRPronto(IRCode,RepeatCount=1)

{

hndl := DllCall("C:\Windows\System32\uuirtdrv.dllUUIRTOpen")

DllCall("C:\Windows\System32\uuirtdrv.dllUUIRTTransmitIR", 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

}

I don't know "HUUHANDLE hHandle" address into the hardware.....Or how can i make?

How do I change from Autohotkey to Autoit ?

Link to comment
Share on other sites

How do I know "HUUHANDLE hHandle"

UUIRTOpen

You posted link to documentation, did you even read it yourself?

EDIT:

Or perhaps you can just use DllOpen()

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

UUIRTOpen

You posted link to documentation, did you even read it yourself?

EDIT:

Or perhaps you can just use DllOpen()

Yes,

I use the dllopen("usbuirt.dll"),but read value is 0.

If don't need to read "HUUHANDLE hHandle" , only use "UUIRTGetDrvInfo"

$n = dllopen("usbuirt.dll)

$ver = dllcall("$n","int","UUIRTGetDrvInfo","Uint","$ver)

It's works! But If I don't use "HUUHANDLE hHandle" (Just like the Transmit)

$result= DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0)

$result value is always 0.

Edited by ericli03
Link to comment
Share on other sites

Yes,

I use the dllopen("usbuirt.dll"),but read value is 0.

If don't need to read "HUUHANDLE hHandle" , only use "UUIRTGetDrvInfo"

$n = dllopen("usbuirt.dll)

$ver = dllcall("$n","int","UUIRTGetDrvInfo","Uint","$ver)

It's works! But If I don't use "HUUHANDLE hHandle" (Just like the Transmit)

$result= DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0)

$result value is always 0.

Yes, because UUIRTGetDrvInfo does not require a handle, UUIRTTransmitIR does.

At the risk of repeating myself again, you should read the documentation.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Yes, because UUIRTGetDrvInfo does not require a handle, UUIRTTransmitIR does.

At the risk of repeating myself again, you should read the documentation.

sorry, I know i have to use UUIRTOpen(void).

But I don't know how do I use.

first I try

$dll = dllopen("usbuirt.dll") ;load dll

$result=DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0)

And arraydisplay($result) read value is 0.

Please tell me where I need to join "UUIRTOpen(void)"

" "int",$hndl " <--here use $hndl But invalid.

Link to comment
Share on other sites

DllCall() is really meant to be used by advanced users who have some knowldge of at least one lower level language.

Problems you experience seem to be related to your lack of knowledge. When that's the case the best thing is to just try, try try... more, then you will either learn or get things to work by accident. Maybe even both. I won't advise you to actually learn, people usually don't like that because it takes time to get them results.

Good luck.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

DllCall() is really meant to be used by advanced users who have some knowldge of at least one lower level language.

Problems you experience seem to be related to your lack of knowledge. When that's the case the best thing is to just try, try try... more, then you will either learn or get things to work by accident. Maybe even both. I won't advise you to actually learn, people usually don't like that because it takes time to get them results.

Good luck.

Thanks Trancexx !!

I really try to dll long time,and i think need one key point.

If can call functions and UUIRTOpen (void) substitution, it should be feasible.

Link to comment
Share on other sites

Sorry,

And I read autohotkey code:

hndl := DllCall("C:\Windows\System32\uuirtdrv.dllUUIRTOpen")

DllCall("C:\Windows\System32\uuirtdrv.dllUUIRTTransmitIR", 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

I know i have to use hndl := DllCall("C:\Windows\System32\uuirtdrv.dllUUIRTOpen") in autoit.

But If use the

$result= DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0) ;"int","$hnd1" = handle

Value always is 0.

Where I wrong?

Walk me through this..

"$result = DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0) ;"int","$hnd1" = handle"

First. Where does $dll come from, and what is it's type and value?

Also, Please do not send uninvited PM's, thank you.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Walk me through this..

"$result = DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0) ;"int","$hnd1" = handle"

First. Where does $dll come from, and what is it's type and value?

Also, Please do not send uninvited PM's, thank you.

Sorry, this is my fault.

$dll = DllOpen("uuirtdrv.dll")

$result = DllCall($dll,"UINT_PTR","UUIRTTransmitIR","int",$hndl,"str","0000","hwnd",0x0010,"int",1,"int",0,"int",0,"uint",0,"uint",0)

Link to comment
Share on other sites

OK, what about your next parameter "UINT_PTR" where did you get that from, and what is it's meaning in your DllCall?

Return type ,and an unsigned 32 bit integer.

Function name is UUIRTTransmitIR, uuirtdrv.dll function.

Link to comment
Share on other sites

Return type ,and an unsigned 32 bit integer.

Function name is UUIRTTransmitIR, uuirtdrv.dll function.

In the documentation you linked, it is indicated that the return type for that function is "BOOL", where did you get the idea to change it to "UINT_PTR"?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

No need to apologise, just read the documentation and keep trying.

If you post again, include the full autoit code in tags that you tried, and include your reasoning behind any parameters you might include.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

No need to apologise, just read the documentation and keep trying.

If you post again, include the full autoit code in tags that you tried, and include your reasoning behind any parameters you might include.

Thanks!

If UUIRTOpen return value is HUUHANDLE,then I should have to be given to what type in autoit?

HUUHANDLE hHandle for each function need to be substituted.

Given category, then what is it?

Or just need join "HANDLE","HUUHANDLE" ?

Really thank you for your answer!

Edited by ericli03
Link to comment
Share on other sites

I would expect it to be HANDLE, at least I would start with that.

The key here (like trancexx mentioned) is trying.

Thanks again to answer! I try "HANDLE","HUUHANDLE" Look at!

Edited by ericli03
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...