Link to home
Start Free TrialLog in
Avatar of darkloser
darkloser

asked on

Select a paper source for QuickReport

I use Lanier lan printer/fax/scaner.
When i print use QuickReport in my program i can't change paper source.
I'll try to change it in printer setup and all is ok /change form upper to lower cassete/, but when after it print is on Upper cassete. Anyone can help me how i can setup printer paper source - option in TPrinter or? to use lower cassete. And that's bug of a QuickReport? Or i'm wrong :)

Thanks
Avatar of asburgoyne
asburgoyne

I think that the following component will do the job for you:-

ftp://ftp.cdrom.com/pub/delphi_www/ftp/d10free/printset.zip

I suffered major problems trying to change printer setup in a recent project but this solved the problem in one line of code!!

You will find many solutions to future problems at Delphi Super Page:-

http://ftp.optiva.ee/delphi/index.htm

Adam
Avatar of darkloser

ASKER

I just ask for source to control printer cassete - manual not automatically :>
when i set a auto property on quick report and chek by default secondary cassete all is ok :) but i wanna give to user choice of it. And search some sources.
Thanks
I just ask for source to control printer cassete - manual not automatically :>
when i set a auto property on quick report and chek by default secondary cassete all is ok :) but i wanna give to user choice of it. And search some sources.
Thanks
I just ask for source to control printer cassete - manual not automatically :>
when i set a auto property on quick report and chek by default secondary cassete all is ok :) but i wanna give to user choice of it. And search some sources.
Thanks
I just ask for source to control printer cassete - manual not automatically :>
when i set a auto property on quick report and chek by default secondary cassete all is ok :) but i wanna give to user choice of it. And search some sources.
Thanks
Don't know, wether this comes before QReport
just try

unit PrinterDevices1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Printers, Winspool;

const

  DM_ORIENTATION = 1;
  DM_PAPERSIZE = 2;
  DM_PAPERLENGTH = 4;
  DM_PAPERWIDTH = 8;
  DM_SCALE = $10;
  DM_COPIES = $100;
  DM_DEFAULTSOURCE = $200;
  DM_PRINTQUALITY = $400;
  DM_COLOR = $800;
  DM_DUPLEX = $1000;
  DM_YRESOLUTION = $2000;
  DM_TTOPTION = $4000;
  DM_COLLATE = $8000;
  DM_FORMNAME = $10000;
  DM_LOGPIXELS = $20000;
  DM_BITSPERPEL = $40000;
  DM_PELSWIDTH = $80000;
  DM_PELSHEIGHT = $100000;
  DM_DISPLAYFLAGS = $200000;
  DM_DISPLAYFREQUENCY = $400000;
  DM_PANNINGWIDTH = $00800000;
  DM_PANNINGHEIGHT = $01000000;
  DM_ICMMETHOD = $2000000;
  DM_ICMINTENT = $4000000;
  DM_MEDIATYPE = $8000000;
  DM_DITHERTYPE = $10000000;
  DM_ICCMANUFACTURER = $20000000;
  DM_ICCMODEL = $40000000;

{ orientation selections }

  DMORIENT_PORTRAIT = 1;
  DMORIENT_LANDSCAPE = 2;

{ paper selections }

  DMPAPER_LETTER      = 1;  { Letter 8 12 x 11 in               }
  DMPAPER_FIRST       = DMPAPER_LETTER;
  DMPAPER_LETTERSMALL = 2;  { Letter Small 8 12 x 11 in         }
  DMPAPER_TABLOID     = 3;  { Tabloid 11 x 17 in                }
  DMPAPER_LEDGER      = 4;  { Ledger 17 x 11 in                 }
  DMPAPER_LEGAL       = 5;  { Legal 8 12 x 14 in                }
  DMPAPER_STATEMENT   = 6;  { Statement 5 12 x 8 12 in          }
  DMPAPER_EXECUTIVE   = 7;  { Executive 7 14 x 10 12 in         }
  DMPAPER_A3      = 8;      { A3 297 x 420 mm                     }
  DMPAPER_A4      = 9;      { A4 210 x 297 mm                     }
  DMPAPER_A4SMALL = 10;     { A4 Small 210 x 297 mm               }
  DMPAPER_A5      = 11;     { A5 148 x 210 mm                     }
  DMPAPER_B4      = 12;     { B4 (JIS) 250 x 354                  }
  DMPAPER_B5      = 13;     { B5 (JIS) 182 x 257 mm               }
  DMPAPER_FOLIO   = 14;     { Folio 8 12 x 13 in                  }
  DMPAPER_QUARTO  = 15;     { Quarto 215 x 275 mm                 }
  DMPAPER_10X14   = 16;     { 10x14 in                            }
  DMPAPER_11X17   = 17;     { 11x17 in                            }
  DMPAPER_NOTE    = 18;     { Note 8 12 x 11 in                   }
  DMPAPER_ENV_9   = 19;     { Envelope #9 3 78 x 8 78             }
  DMPAPER_ENV_10  = 20;     { Envelope #10 4 18 x 9 12            }
  DMPAPER_ENV_11  = 21;     { Envelope #11 4 12 x 10 38           }
  DMPAPER_ENV_12  = 22;     { Envelope #12 4 \276 x 11            }
  DMPAPER_ENV_14  = 23;     { Envelope #14 5 x 11 12              }
  DMPAPER_CSHEET  = 24;     { C size sheet                        }
  DMPAPER_DSHEET  = 25;     { D size sheet                        }
  DMPAPER_ESHEET  = 26;     { E size sheet                        }
  DMPAPER_ENV_DL  = 27;     { Envelope DL 110 x 220mm             }
  DMPAPER_ENV_C5  = 28;     { Envelope C5 162 x 229 mm            }
  DMPAPER_ENV_C3  = 29;     { Envelope C3  324 x 458 mm           }
  DMPAPER_ENV_C4  = 30;     { Envelope C4  229 x 324 mm           }
  DMPAPER_ENV_C6  = 31;     { Envelope C6  114 x 162 mm           }
  DMPAPER_ENV_C65  = 32;    { Envelope C65 114 x 229 mm           }
  DMPAPER_ENV_B4   = 33;    { Envelope B4  250 x 353 mm           }
  DMPAPER_ENV_B5   = 34;    { Envelope B5  176 x 250 mm           }
  DMPAPER_ENV_B6   = 35;    { Envelope B6  176 x 125 mm           }
  DMPAPER_ENV_ITALY          = 36;  { Envelope 110 x 230 mm               }
  DMPAPER_ENV_MONARCH        = 37;  { Envelope Monarch 3.875 x 7.5 in     }
  DMPAPER_ENV_PERSONAL       = 38;  { 6 34 Envelope 3 58 x 6 12 in        }
  DMPAPER_FANFOLD_US         = 39;  { US Std Fanfold 14 78 x 11 in        }
  DMPAPER_FANFOLD_STD_GERMAN = 40;  { German Std Fanfold 8 12 x 12 in    }
  DMPAPER_FANFOLD_LGL_GERMAN = 41;  { German Legal Fanfold 8 12 x 13 in  }
  DMPAPER_ISO_B4             = 42;  { B4 (ISO) 250 x 353 mm               }
  DMPAPER_JAPANESE_POSTCARD  = 43;  { Japanese Postcard 100 x 148 mm      }
  DMPAPER_9X11               = 44;  { 9 x 11 in                           }
  DMPAPER_10X11              = 45;  { 10 x 11 in                          }
  DMPAPER_15X11              = 46;  { 15 x 11 in                          }
  DMPAPER_ENV_INVITE         = 47;  { Envelope Invite 220 x 220 mm        }
  DMPAPER_RESERVED_48        = 48;  { RESERVED--DO NOT USE                }
  DMPAPER_RESERVED_49        = 49;  { RESERVED--DO NOT USE                }
  DMPAPER_LETTER_EXTRA       = 50;  { Letter Extra 9 \275 x 12 in         }
  DMPAPER_LEGAL_EXTRA        = 51;  { Legal Extra 9 \275 x 15 in          }
  DMPAPER_TABLOID_EXTRA      = 52;  { Tabloid Extra 11.69 x 18 in         }
  DMPAPER_A4_EXTRA           = 53;  { A4 Extra 9.27 x 12.69 in            }
  DMPAPER_LETTER_TRANSVERSE  = 54;  { Letter Transverse 8 \275 x 11 in    }
  DMPAPER_A4_TRANSVERSE      = 55;  { A4 Transverse 210 x 297 mm          }
  DMPAPER_LETTER_EXTRA_TRANSVERSE = 56;     { Letter Extra Transverse 9\275 x 12 in  }
  DMPAPER_A_PLUS        = 57;     { SuperASuperAA4 227 x 356 mm       }
  DMPAPER_B_PLUS        = 58;     { SuperBSuperBA3 305 x 487 mm       }
  DMPAPER_LETTER_PLUS   = 59;     { Letter Plus 8.5 x 12.69 in          }
  DMPAPER_A4_PLUS       = 60;     { A4 Plus 210 x 330 mm                }
  DMPAPER_A5_TRANSVERSE = 61;     { A5 Transverse 148 x 210 mm          }
  DMPAPER_B5_TRANSVERSE = 62;     { B5 (JIS) Transverse 182 x 257 mm    }
  DMPAPER_A3_EXTRA      = 63;     { A3 Extra 322 x 445 mm               }
  DMPAPER_A5_EXTRA      = $40;    { A5 Extra 174 x 235 mm               }
  DMPAPER_B5_EXTRA      = 65;     { B5 (ISO) Extra 201 x 276 mm         }
  DMPAPER_A2            = 66;     { A2 420 x 594 mm                     }
  DMPAPER_A3_TRANSVERSE = 67;     { A3 Transverse 297 x 420 mm          }
  DMPAPER_A3_EXTRA_TRANSVERSE = 68;     { A3 Extra Transverse 322 x 445 mm    }
{
 ** the following sizes are reserved for the Far East version of Win95.
 ** Rotated papers rotate the physical page but not the logical page.
}
  DMPAPER_DBL_JAPANESE_POSTCARD = 69; { Japanese Double Postcard 200 x 148 mm }
  DMPAPER_A6                  = 70;  { A6 105 x 148 mm                 }
  DMPAPER_JENV_KAKU2          = 71;  { Japanese Envelope Kaku #2       }
  DMPAPER_JENV_KAKU3          = 72;  { Japanese Envelope Kaku #3       }
  DMPAPER_JENV_CHOU3          = 73;  { Japanese Envelope Chou #3       }
  DMPAPER_JENV_CHOU4          = 74;  { Japanese Envelope Chou #4       }
  DMPAPER_LETTER_ROTATED      = 75;  { Letter Rotated 11 x 8 1/2 11 in }
  DMPAPER_A3_ROTATED          = 76;  { A3 Rotated 420 x 297 mm         }
  DMPAPER_A4_ROTATED          = 77;  { A4 Rotated 297 x 210 mm         }
  DMPAPER_A5_ROTATED          = 78;  { A5 Rotated 210 x 148 mm         }
  DMPAPER_B4_JIS_ROTATED      = 79;  { B4 (JIS) Rotated 364 x 257 mm   }
  DMPAPER_B5_JIS_ROTATED      = 80;  { B5 (JIS) Rotated 257 x 182 mm   }
  DMPAPER_JAPANESE_POSTCARD_ROTATED = 81; { Japanese Postcard Rotated 148 x 100 mm }
  DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82; { Double Japanese Postcard Rotated 148 x 200 mm }
  DMPAPER_A6_ROTATED          = 83;  { A6 Rotated 148 x 105 mm         }
  DMPAPER_JENV_KAKU2_ROTATED  = 84;  { Japanese Envelope Kaku #2 Rotated}
  DMPAPER_JENV_KAKU3_ROTATED  = 85;  { Japanese Envelope Kaku #3 Rotated}
  DMPAPER_JENV_CHOU3_ROTATED  = 86;  { Japanese Envelope Chou #3 Rotated}
  DMPAPER_JENV_CHOU4_ROTATED  = 87;  { Japanese Envelope Chou #4 Rotated}
  DMPAPER_B6_JIS              = 88;  { B6 (JIS) 128 x 182 mm           }
  DMPAPER_B6_JIS_ROTATED      = 89;  { B6 (JIS) Rotated 182 x 128 mm   }
  DMPAPER_12X11               = 90;  { 12 x 11 in                      }
  DMPAPER_JENV_YOU4           = 91;  { Japanese Envelope You #4        }
  DMPAPER_JENV_YOU4_ROTATED   = 92;  { Japanese Envelope You #4 Rotated}
  DMPAPER_P16K                = 93;  { PRC 16K 146 x 215 mm            }
  DMPAPER_P32K                = 94;  { PRC 32K 97 x 151 mm             }
  DMPAPER_P32KBIG             = 95;  { PRC 32K(Big) 97 x 151 mm        }
  DMPAPER_PENV_1              = 96;  { PRC Envelope #1 102 x 165 mm    }
  DMPAPER_PENV_2              = 97;  { PRC Envelope #2 102 x 176 mm    }
  DMPAPER_PENV_3              = 98;  { PRC Envelope #3 125 x 176 mm    }
  DMPAPER_PENV_4              = 99;  { PRC Envelope #4 110 x 208 mm    }
  DMPAPER_PENV_5              = 100; { PRC Envelope #5 110 x 220 mm    }
  DMPAPER_PENV_6              = 101; { PRC Envelope #6 120 x 230 mm    }
  DMPAPER_PENV_7              = 102; { PRC Envelope #7 160 x 230 mm    }
  DMPAPER_PENV_8              = 103; { PRC Envelope #8 120 x 309 mm    }
  DMPAPER_PENV_9              = 104; { PRC Envelope #9 229 x 324 mm    }
  DMPAPER_PENV_10             = 105; { PRC Envelope #10 324 x 458 mm   }
  DMPAPER_P16K_ROTATED        = 106; { PRC 16K Rotated                 }
  DMPAPER_P32K_ROTATED        = 107; { PRC 32K Rotated                 }
  DMPAPER_P32KBIG_ROTATED     = 108; { PRC 32K(Big) Rotated            }
  DMPAPER_PENV_1_ROTATED      = 109; { PRC Envelope #1 Rotated 165 x 102 mm}
  DMPAPER_PENV_2_ROTATED      = 110; { PRC Envelope #2 Rotated 176 x 102 mm}
  DMPAPER_PENV_3_ROTATED      = 111; { PRC Envelope #3 Rotated 176 x 125 mm}
  DMPAPER_PENV_4_ROTATED      = 112; { PRC Envelope #4 Rotated 208 x 110 mm}
  DMPAPER_PENV_5_ROTATED      = 113; { PRC Envelope #5 Rotated 220 x 110 mm}
  DMPAPER_PENV_6_ROTATED      = 114; { PRC Envelope #6 Rotated 230 x 120 mm}
  DMPAPER_PENV_7_ROTATED      = 115; { PRC Envelope #7 Rotated 230 x 160 mm}
  DMPAPER_PENV_8_ROTATED      = 116; { PRC Envelope #8 Rotated 309 x 120 mm}
  DMPAPER_PENV_9_ROTATED      = 117; { PRC Envelope #9 Rotated 324 x 229 mm}
  DMPAPER_PENV_10_ROTATED     = 118; { PRC Envelope #10 Rotated 458 x 324 mm }
  DMPAPER_LAST                = DMPAPER_PENV_10_ROTATED;
  DMPAPER_USER                = $100;

{ bin selections }

  DMBIN_UPPER = 1;
  DMBIN_FIRST = DMBIN_UPPER;
  DMBIN_ONLYONE = 1;
  DMBIN_LOWER = 2;
  DMBIN_MIDDLE = 3;
  DMBIN_MANUAL = 4;
  DMBIN_ENVELOPE = 5;
  DMBIN_ENVMANUAL = 6;
  DMBIN_AUTO = 7;
  DMBIN_TRACTOR = 8;
  DMBIN_SMALLFMT = 9;
  DMBIN_LARGEFMT = 10;
  DMBIN_LARGECAPACITY = 11;
  DMBIN_CASSETTE = 14;
  DMBIN_FORMSOURCE = 15;
  DMBIN_LAST = DMBIN_FORMSOURCE;
  DMBIN_USER = $100;   { device specific bins start here }

  { print qualities }
  DMRES_DRAFT = -1;
  DMRES_LOW = -2;
  DMRES_MEDIUM = -3;
  DMRES_HIGH = -4;

  { color enabledisable for color printers }
  DMCOLOR_MONOCHROME = 1;
  DMCOLOR_COLOR = 2;

  { duplex enable }
  DMDUP_SIMPLEX = 1;
  DMDUP_VERTICAL = 2;
  DMDUP_HORIZONTAL = 3;

  { TrueType options }
  DMTT_BITMAP           = 1;     { print TT fonts as graphics  }
  DMTT_DOWNLOAD         = 2;     { download TT fonts as soft fonts  }
  DMTT_SUBDEV           = 3;     { substitute device fonts for TT fonts  }
  DMTT_DOWNLOAD_OUTLINE = 4;     { download TT fonts as outline soft fonts  }

  { Collation selections }
  DMCOLLATE_FALSE = 0;
  DMCOLLATE_TRUE = 1;

  { DEVMODE dmDisplayFlags flags }
  DM_GRAYSCALE = $00000001;  { removed in 4.0 SDK }
  DM_INTERLACED = $00000002; { removed in 4.0 SDK }
  DM_TEXTMODE = $00000004;   { removed in 4.0 SDK }
  DMDISPLAYFLAGS_TEXTMODE     = $00000004;

  { ICM methods }
  DMICMMETHOD_NONE   = 1;     { ICM disabled  }
  DMICMMETHOD_SYSTEM = 2;     { ICM handled by system  }
  DMICMMETHOD_DRIVER = 3;     { ICM handled by driver  }
  DMICMMETHOD_DEVICE = 4;     { ICM handled by device  }

  DMICMMETHOD_USER = $100;    { Device-specific methods start here  }

  { ICM Intents }
  DMICM_SATURATE    = 1;     { Maximize color saturation  }
  DMICM_CONTRAST    = 2;     { Maximize color contrast  }
  DMICM_COLORMETRIC = 3;     { Use specific color metric  }

  DMICM_USER = $100;     { Device-specific intents start here  }


  { Media types }
  DMMEDIA_STANDARD     = 1;     { Standard paper  }
  DMMEDIA_TRANSPARENCY = 2;     { Transparency  }
  DMMEDIA_GLOSSY       = 3;     { Glossy paper  }

  DMMEDIA_USER = $100;     { Device-specific media start here  }


  { Dither types }
  DMDITHER_NONE      = 1;     { No dithering  }
  DMDITHER_COARSE    = 2;     { Dither with a coarse brush  }
  DMDITHER_FINE      = 3;     { Dither with a fine brush  }
  DMDITHER_LINEART   = 4;     { LineArt dithering  }
  DMDITHER_GRAYSCALE = 5;     { Device does grayscaling  }

  DMDITHER_USER = 256;        { Device-specific dithers start here  }


type
  TForm1 = class(TForm)

    Memo1: TMemo;
    PrinterSetupDialog1: TPrinterSetupDialog;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    ListBox1: TListBox;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  ADevice, ADriver, APort: array [0..255] of char;
  ADeviceMode: THandle;
  DevMode: PDevMode;
implementation

{$R *.DFM}

// Change printer...
procedure TForm1.Button1Click(Sender: TObject);
var
  Device : array[0..255] of char;
  Driver : array[0..255] of char;
  Port   : array[0..255] 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

      {Set to }
      pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
//      pDMode^.dmPaperSize := DMPAPER_LEGAL;
        pDMode^.dmPaperSize := DMPAPER_A5;
        pDMode^.dmOrientation := DMORIENT_LANDSCAPE;
//      pDMode^.dmFields := pDMode^.dmFields or
//             DM_PAPERSIZE or
//             DM_PAPERWIDTH or
//             DM_PAPERLENGTH;
//      pDMode^.dmPaperSize := DMPAPER_USER;
//      pDMode^.dmPaperWidth := 100
      {SomeValueInTenthsOfAMillimeter};
//      pDMode^.dmPaperLength := 100
      {SomeValueInTenthsOfAMillimeter};

      {Set the bin to use}
//      pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
//      pDMode^.dmDefaultSource := DMBIN_MANUAL;
//      Printer.SetPrinter(Device, Driver, Port, hDMode);
      GlobalUnlock(hDMode);
    end;
  end;
    Printer.PrinterIndex := Printer.PrinterIndex;
    Printer.BeginDoc;
    Printer.Canvas.Font.Name := 'Courier New';
    Printer.Canvas.Font.Size := 10;
    Printer.Canvas.Font.Color:=ClRed;
    Printer.Canvas.TextOut(150,150,
    'Testing Din A5 on point 150,150 Landscape');
    Printer.EndDoc;
    Button2Click(form1);
end;

// change printer settings
procedure TForm1.Button4Click(Sender: TObject);
begin
      with Printer do
      begin
      GetPrinter(ADevice,ADriver,APort,ADeviceMode);
      SetPrinter(ADevice,ADriver,APort,0);
      GetPrinter(ADevice,ADriver,APort,ADeviceMode);
      DevMode := GlobalLock(ADeviceMode);
      if not Assigned(DevMode) then
        ShowMessage('kann printer nicht dndern.')
      else
      begin
        with DevMode^ do
        begin
//      change anything in devmode structure
        dmDefaultSource := DMBIN_UPPER;
        dmPaperSize := DMPAPER_A4;
        dmOrientation := DMORIENT_PORTRAIT;
//      the constants are listed in "Windows.pas"

        end;
      GlobalUnlock(ADeviceMode);
      end;
    end;

    Printer.BeginDoc;
    Printer.Canvas.Font.Name := 'Arial';
    Printer.Canvas.Font.Size := 12;
    Printer.Canvas.Font.Color:=ClBlack;
    Printer.Canvas.TextOut(300,300,
    'UPPER PAPER TRAY Portrait Din A4 point 300,300');
//    Printer.NewPageDC(DevMode);
    Printer.EndDoc;
    Button2Click(form1);
     sleep(5000);

//   Change again

    with Printer do
      begin
      GetPrinter(ADevice,ADriver,APort,ADeviceMode);
      SetPrinter(ADevice,ADriver,APort,0);
      GetPrinter(ADevice,ADriver,APort,ADeviceMode);
      DevMode := GlobalLock(ADeviceMode);
      if not Assigned(DevMode) then
        ShowMessage('kann printer nicht dndern.')
      else
      begin
        with DevMode^ do
        begin
          dmDefaultSource := DMBIN_LOWER;
          dmPaperSize := DMPAPER_A5;
          dmOrientation := DMORIENT_LANDSCAPE;
        end;
      GlobalUnlock(ADeviceMode);

      end;
    end;
    Printer.BeginDoc;
    Printer.Canvas.TextOut(500,500,
    'LOWER PAPER TRAY Landscape Din A5 at point 500,500');
    Printer.EndDoc;
    Button2Click(form1);
end;

// read printer settings
procedure TForm1.Button2Click(Sender: TObject);
begin
      with Printer do
      begin

      GetPrinter(ADevice,ADriver,APort,ADeviceMode);
      DevMode := GlobalLock(ADeviceMode);
      if not Assigned(DevMode) then ShowMessage('kann printer nicht finden.')
      else
      begin
           with DevMode^ do
           begin

           memo1.lines.add('Printername : ' + dmDeviceName);
           memo1.lines.add('Specversion ' + IntToStr(dmSpecVersion));
           memo1.lines.add('Driverversion ' + IntToStr(dmDriverVersion));
           memo1.lines.add('Size ' + IntToStr(dmSize));
           memo1.lines.add('DriverExtra ' + IntToStr(dmDriverExtra));
           memo1.lines.add('Fields ' + IntToStr(dmFields));
           memo1.lines.add('Source ' + IntToStr(dmDefaultSource));
           memo1.lines.add('Orientation ' + IntToStr(dmOrientation));
           memo1.lines.add('Papersize ' + IntToStr(dmPaperSize));
           memo1.lines.add('PrintQuality ' + IntToStr(dmPrintQuality));
           memo1.lines.add('---------------  Check the constants  ---------------');
           memo1.lines.add(ADevice);
           memo1.lines.add(ADriver);
           memo1.lines.add(Aport);
           memo1.lines.add(IntToStr(aDevicemode));
           memo1.lines.add('*****************************************************');

//     etc.
           end;
      end;
       GlobalUnlock(ADeviceMode);
      end;
end;

{   Here's the TDevMode structure with all the things you can change like
   this:

   _devicemodeA = packed record
   dmDeviceName: array[0..CCHDEVICENAME - 1] of AnsiChar;
   dmSpecVersion: Word;
   dmDriverVersion: Word;
   dmSize: Word;
   dmDriverExtra: Word;
   dmFields: DWORD;
   dmOrientation: SHORT;
   dmPaperSize: SHORT;
   dmPaperLength: SHORT;
   dmPaperWidth: SHORT;
   dmScale: SHORT;
   dmCopies: SHORT;
   dmDefaultSource: SHORT;
   dmPrintQuality: SHORT;
   dmColor: SHORT;
   dmDuplex: SHORT;
   dmYResolution: SHORT;
   dmTTOption: SHORT;
   dmCollate: SHORT;
   dmFormName: array[0..CCHFORMNAME - 1] of AnsiChar;
   dmLogPixels: Word;
   dmBitsPerPel: DWORD;
   dmPelsWidth: DWORD;
   dmPelsHeight: DWORD;
   dmDisplayFlags: DWORD;
   dmDisplayFrequency: DWORD;
   dmICMMethod: DWORD;
   dmICMIntent: DWORD;
   dmMediaType: DWORD;
   dmDitherType: DWORD;
   dmICCManufacturer: DWORD;
   dmICCModel: DWORD;
   dmPanningWidth: DWORD;
   dmPanningHeight: DWORD;
   end; }

procedure TForm1.Button3Click(Sender: TObject);
begin
     printersetupdialog1.Execute;
end;


end.

Hope, it's all there
Indi
Heh how many code :))
pls can you say me juzt how i can change tray of printer - from upper to lower cassete :)

dmDefaultSource: SHORT;
I wanna change it, not know what is selected :)
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Indefrei
Indefrei

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And when i wanna change a tray what i can change?
 dmDefaultSource := DMBIN_UPPER;
 or so? :)
I search just code to change a tray. Other parameters i change with no problem, problem is just with work with tray - every time i print to default.\
Thanks
Yes
dmDefaultSource := DMBIN_UPPER;
should work

{ bin selections }

                      DMBIN_UPPER = 1;
                      DMBIN_FIRST = DMBIN_UPPER;
                      DMBIN_ONLYONE = 1;
                      DMBIN_LOWER = 2;
                      DMBIN_MIDDLE = 3;
                      DMBIN_MANUAL = 4;
                      DMBIN_ENVELOPE = 5;
                      DMBIN_ENVMANUAL = 6;
                      DMBIN_AUTO = 7;
                      DMBIN_TRACTOR = 8;
                      DMBIN_SMALLFMT = 9;
                      DMBIN_LARGEFMT = 10;
                      DMBIN_LARGECAPACITY = 11;
                      DMBIN_CASSETTE = 14;
                      DMBIN_FORMSOURCE = 15;
                      DMBIN_LAST = DMBIN_FORMSOURCE;
                      DMBIN_USER = $100;   { device specific bins start here }

If not, i don't know further,
Sorry
Indi
OK thanks :)
I'll try to attempt :)
I'll give you a points later, i'll be waitnig for more answers or ideas.
Thank's

best regards
Comment accepted as answer