mikepj
asked on
How can I get detailed printer info?
Hi,
I need to obtain the detailed information about a printer:
DriverName
PortName
DeviceName
These things don't seem to be available in the TPrinter object.
Thank you!
MP
I need to obtain the detailed information about a printer:
DriverName
PortName
DeviceName
These things don't seem to be available in the TPrinter object.
Thank you!
MP
see DeviceCapabilities on your help file
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and windows api example :
different levels of info (see api help!)
printers.getprinter uses a different level if on win NT (level 4)or Win95/98 (level 5)
Var
pInfo: PPrinterInfo2;
bytesNeeded: DWORD;
hPrinter: THandle;
Begin
GetPrinter( hPrinter, 2, Nil, 0, @bytesNeeded );
pInfo := AllocMem( bytesNeeded );
try
GetPrinter( hPrinter, 2, pInfo, bytesNeeded, @bytesNeeded );
With pInfo^ Do Begin
End;
finally
FreeMem( pInfo );
end;
end;
different levels of info (see api help!)
printers.getprinter uses a different level if on win NT (level 4)or Win95/98 (level 5)
Var
pInfo: PPrinterInfo2;
bytesNeeded: DWORD;
hPrinter: THandle;
Begin
GetPrinter( hPrinter, 2, Nil, 0, @bytesNeeded );
pInfo := AllocMem( bytesNeeded );
try
GetPrinter( hPrinter, 2, pInfo, bytesNeeded, @bytesNeeded );
With pInfo^ Do Begin
End;
finally
FreeMem( pInfo );
end;
end;
ASKER
Dear ZifNab,
Thank you for your answer; it works! I had looked a lot at GetPrinter but decided that it didn't have what I needed after I saw that the first three parameters didn't have "var" before them. Because they're PChar types they don't need to have "var" in front?
Thank you for your help!
MP
Thank you for your answer; it works! I had looked a lot at GetPrinter but decided that it didn't have what I needed after I saw that the first three parameters didn't have "var" before them. Because they're PChar types they don't need to have "var" in front?
Thank you for your help!
MP
Create a new proyect
add a listbox
add a button
on the click event of the button write
Listbox1.items.addstrings(
Run it!