Mega Code Archive

 
Categories / Delphi / Printing
 

Get paper source

Title: Get paper source Use DevMode structure to detect paper source. uses Printers; ... procedure TForm1.Button2Click(Sender: TObject); var Device: array[0..cchDevicename-1] of Char; Driver: array[0..(MAX_PATH)-1] of Char; Port: array[0..32] of Char; hDMode: THandle; pDMode: PDevMode; begin Printer.GetPrinter(Device, Driver, Port, hDMode); if (hDMode&lt&gt0) then begin pDMode:=GlobalLock(hDMode); if pDMode&lt&gtnil then begin if (pDMode^.dmDefaultSource=7) then Label1.Caption:='Paper source - auto'; if (pDMode^.dmDefaultSource=4) then Label1.Caption:='Paper source - manual'; end; end; end;