Jump to content

DllCall with Byte data type

Recommended Posts

Hi, I have been using AutoIT only for two days and the main reason is DllCall feature. But I have issue with procedure  which needs Byte as parameter.

 #include <MsgBoxConstants.au3>
 #include <Array.au3>

This works OK:

$calldata=DllCall("C:\rv.dll","none","rvgetroavg","double","-10","double","80","double","8","double","20", "double", "101325","double*","","boolean*", "")
MsgBox($MB_SYSTEMMODAL, "rvgetroavg", _ArrayToString($calldata, @CRLF))


$calldata=DllCall("C:\rv.dll","none","rvgetw","double","1500","double","500","boolean", "False","double*","","double*","","boolean*", "")
MsgBox($MB_SYSTEMMODAL, "rvgetw", _ArrayToString($calldata, @CRLF))

But procedures using "Byte" doesnt work, for example:

$calldata=DllCall("C:\rv.dll","none","rvgetdP","double","2","double","1","byte","0","byte","0", "boolean", "True","boolean","True","double*", "","boolean*", "")
MsgBox($MB_SYSTEMMODAL, "rvgetdPnew", _ArrayToString($calldata, @CRLF))

In DLL documentation is written: rvgetdP(w,ro:double;d200,mat,enthalpic:byte; var dP: double;var chyba: boolean);stdcall;

Thank you for help.




Link to post
Share on other sites
8 hours ago, btjacker said:

This works OK:

$calldata=DllCall("C:\rv.dll","none","rvgetroavg","double","-10","double","80","double","8","double","20", "double", "101325","double*","","boolean*", "")
MsgBox($MB_SYSTEMMODAL, "rvgetroavg", _ArrayToString($calldata, @CRLF))


$calldata=DllCall("C:\rv.dll","none","rvgetw","double","1500","double","500","boolean", "False","double*","","double*","","boolean*", "")
MsgBox($MB_SYSTEMMODAL, "rvgetw", _ArrayToString($calldata, @CRLF))

Should not, because "8" or "101325" is definitely NOT a double, it is STRING (char).  And "False" is not a boolean, but False is. 

Examining the dll with IDA shows:

; Attributes: bp-based frame

public rvgetw
rvgetw proc near

var_18= qword ptr -18h
var_10= qword ptr -10h
var_8= qword ptr -8
arg_0= qword ptr  8
arg_8= qword ptr  10h
arg_10= byte ptr  18h
arg_14= dword ptr  1Ch
arg_18= dword ptr  20h
arg_1C= dword ptr  24h

push    ebp
mov     ebp, esp
add     esp, 0FFFFFFE8h
push    ebx
mov     ebx, [ebp+arg_1C]
mov     edx, [ebp+arg_18]
mov     ecx, [ebp+arg_14]
xor     eax, eax
mov     dword ptr [ebp+var_8], eax
mov     dword ptr [ebp+var_8+4], eax
xor     eax, eax
mov     dword ptr [ebp+var_10], eax
mov     dword ptr [ebp+var_10+4], eax
xor     eax, eax
mov     dword ptr [ebp+var_18], eax
mov     dword ptr [ebp+var_18+4], eax
mov     byte ptr [ebx], 0
fld     [ebp+arg_0]
fcomp   flt_412370
fnstsw  ax
jbe     short loc_41211F

Your problem is not the dll nor AutoIt, your problem is not to know how to work with a dll, irrelevant which computer-language you choose....

Link to post
Share on other sites

Thanks for reply, ok I admit, I have no idea how to work with Dll. I just know, that I have to call it with parameters and get a result. This Dll should just return values of heat exchangers based on values provided in DllCall function. Nothing more. If it is possible to do this in AutoIt, could your (or anyone) please rewrite the last DllCall function in first post? Thank you

Link to post
Share on other sites

Here is a part about rvgetdP procedure. Docu is also attached. Thank you for your time.

3.2 procedure rvgetdP(w,ro:double;d200,mat,enthalpic:byte; var dP:double;var chyba: boolean);stdcall;








Air velocity at the cross-section of air flow – use the result returned by rvgetw function.




Average air density at given pressure in actual temperature and humidity range. For determining this parameter you can use rvgetroavg function, which will be described below.


[ - ]


Determines the wave height / rotor depth in millimetres:

2.3/250 mm  => d200=0

1.9/200 mm  => d200=1

1.6/200 mm  => d200=2

1.4/200 mm  => d200=3


[ - ]


Determines the material of the enthalpy layer in case of exchanger with humidity transfer function.

0 - T–without enthalpy layer

1 - ES,SS–enthalpy layer based on silicon

2 - EZ–enthalpy layer based on molecular sieves


[ - ]


Determines the surface of enthalpy layer application

0 - T  - without enthalpy layer

1 –these types are not produced any more

2 - ES, EZ–application on wavymetal sheet

3 - SS–application on all surfaces




Return parameter determining the pressure loss




Return parameter specifying the credibility of the result.

True – non-credible result

False – there occurred no error during the calculation


Link to post
Share on other sites

Something like that?

Local $calldata = DllCall("C:\rv.dll", "none", "rvgetdP", _
                        "double", 2., _ ; w
                        "double", 1., _ ; ro
                        "byte", 0, _    ; d200          2.3/250 mm
                        "byte", 0, _    ; mat           0 - T  - without enthalpy layer
                        "byte", 0, _    ; enthalpic     0 - T  - without enthalpy layer
                        "double*", 0, _ ; dP return value
                        "boolean*", 0)  ; chyba return value
If @error Then
    ; process DllCall error


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...