Skip to content

Instantly share code, notes, and snippets.

@MattDiesel
Last active December 18, 2015 23:38
Show Gist options
  • Save MattDiesel/5862545 to your computer and use it in GitHub Desktop.
Save MattDiesel/5862545 to your computer and use it in GitHub Desktop.
Local $handleDLL = DLLOpen("C:\DelcomDLL.dll")
Local $devices = DllCall($handleDLL,"dword","DelcomGetDeviceCount","dword",0)
Local $stStrings[$devices[0]]
Local $tDeviceArray = DllStructCreate("wchar* Items[" & $devices[0] & "]")
For $i = 1 To $devices[0]
$stStrings[$i - 1] = DllStructCreate("wchar Name[512]")
DllStructSetData($tDeviceArray, "Items", $stStrings[$i - 1], $i)
Next
Local $result = DllCall($handleDLL,"dword","DelcomGetNthDevice","dword",1,"dword",0,"ptr",DllStructGetPtr($tDeviceArray))
For $i = 1 To $devices[0]
MsgBox(0, "Device number " & $i, DllStructGetData($stStrings[$i - 1], "Name"))
Next
DllClose($handleDLL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment