Jump to content

CallDll problems


Recommended Posts

I have a dll that a client wants me to write a small script for; so I thought it would be a good time to learn to use AutoIT with DLL's.

$cDriveSN = DllCall(".\\GetDiskSerial.dll", "str", "GetSerialNumber", "int", 0, "str", "00000");

The 1st parameter is the drive # to fetch the serial # for.

The 2nd parameter is just the "registration code" to "unlock" the dll.

$cDriveSN is always empty.

What have I done wrong?

Thanks

-josh

Link to comment
Share on other sites

$cDriveSN = DllCall(".\\GetDiskSerial.dll", "str", "GetSerialNumber", "int", 0, "str", "00000")
Switch @ERROR
    Case 1
        ConsoleWrite("Unable to use the DLL file" & @CRLF)
    Case 2
        ConsoleWrite("Unknown return type", & @CRLF)
    Case 3
        ConsoleWrite("Function not found in the DLL file" & @CRLF)
EndSwitch

If IsArray($cDriveSN) Then
    For $X = 0 to Ubound($cDriveSN)-1
        ConsoleWrite("[" & $X & "]: " & $cDriveSN[$X] & @CRLF)
    Next
Else
    ConsoleWrite("$cDriveSN is not an array" & @CRLF)
EndIf

Edited by weaponx
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...