Jump to content

how can i convert this fucn to au3


Recommended Posts

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

Link to comment
Share on other sites

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
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...