hi all,
i am using this routine to list the local printers installed on on a machine...
var
p: pointer;
hpi: _PRINTER_INFO_2A;
hGlobal: cardinal;
dwNeeded, dwReturned: DWORD;
bFlag: boolean;
i: dword;
begin
p := nil;
EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, 0, dwNeeded, dwReturned);
if (dwNeeded = 0) then exit;
GetMem(p,dwNeeded);
if (p = nil) then exit;
bFlag := EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, dwneeded, dwNeeded, dwReturned);
if (not bFlag) then exit;
CbLblPrinterPath.Properties.Items.Clear;
for i := 0 to dwReturned - 1 do
begin
CbLblPrinterPath.Properties.Items.Add(TPrinterInfos(p^)[i].pPrinterName);
end;
FreeMem(p);
TPrinterInfos(p^)[i].pPrinterName returns a 'P' for printer name. i have a PdfCreator installed as a printer.
TPrinterInfos is an array of _PRINTER_INFO_2A.
how can i fix this?