I am having problem with the following code in autoit.
it is suppose to list all printers available in my system and the curresponding papernames supported by each printer.
but am getting only the printer names ans series of '0s' which is suppose to be the papernames
#include <Debug.au3>
#include <String.au3>
Const $DC_BINS = 6
Const $DC_BINNAMES = 12
Const $DC_PAPERNAMES = 16
Const $DC_PAPERS = 2
Const $DC_PAPERSIZE = 3
Dim $BinNameList
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colInstalledPrinters = $objWMIService.ExecQuery ("Select Name, PortName from Win32_Printer")
For $objPrinter In $colInstalledPrinters
$result = DllCall("winspool.drv", "long", "DeviceCapabilitiesA", "str", $objPrinter.Name, "str", $objPrinter.PortName, "int", $DC_PAPERS, "str", Chr(0), "long", 0)
$s_struct = ""
_DebugSetup ($s_struct)
$s_struct=_StringRepeat("0", $result[0]*64)
;$s_struct = StringTrimRight($s_struct, 1)
$struct = DllStructCreate($s_struct)
$result2 = DllCall("winspool.drv", "long", "DeviceCapabilitiesA", "str", $objPrinter.Name, "str", $objPrinter.PortName, "int", $DC_PAPERNAMES, "ptr", DllStructGetPtr($struct), "long", 0)
_DebugOut ( $objPrinter.Name)
For $i = 0 To $result[0]-1
_DebugOut (DllStructGetData($struct, $i))
Next
$struct = 0
Next