Jump to content
Sign in to follow this  
sunless

how can i convert this fucn to au3

Recommended Posts

sunless

i want use a delphi fucn

Function GetVolume(strVolumeMountPoint, strVolumeName:String; intBufferLength:Longword):integer; stdcall; external 'DiskVolume.dll';

but i convert it au3 ,it not work

Func _GetVolume($diskname)

$str = "char[128]"

$a = DllStructCreate($str)

$rc= DllCall("DiskVolume.dll","ubyte","GetVolume","str",$diskname,"ptr",DllStructGetPtr ($a))

$dd = DllStructGetData($a,1)

Return $dd

EndFunc

Share this post


Link to post
Share on other sites
PaulIA

i want use a delphi fucn

Function GetVolume(strVolumeMountPoint, strVolumeName:String; intBufferLength:Longword):integer; stdcall; external 'DiskVolume.dll';

but i convert it au3 ,it not work

Func _GetVolume($diskname)

$str = "char[128]"

$a = DllStructCreate($str)

$rc= DllCall("DiskVolume.dll","ubyte","GetVolume","str",$diskname,"ptr",DllStructGetPtr ($a))

$dd = DllStructGetData($a,1)

Return $dd

EndFunc

You're not providing the correct parameters in DllCall. The function requires 3 parameters and you're only passing 2. I have no way of testing this because I could not find DiskVolume.dll anywhere in any of the Delphi environments that I have, but if you posted the prototype correctly, the function should look like this:

Func GetVolume($sMountPoint)
  Local $aResult
  $aResult = DllCall("DiskVolume.dll", "int", "GetVolume", "str", $sMountPoint, "str", "", "int", 128)
  Return SetError($aResult[0], 0, $aResult[2])
EndFunc

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


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
Sign in to follow this  

×