Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Get paper source - System info - Tips & Tricks - Greatis Delphi Pages

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<>0) then
  begin
    pDMode:=GlobalLock(hDMode);
    if pDMode<>nil 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;
Related topics
Detect paper format

For more
Win32 programmer's reference

We recommend
Greatis Print Suite

Download source