Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to set a printer to duplex mode Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
26-Mar-04
Category
Reporting /Printing
Language
Delphi 2.x
Views
189
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Peter Below

How to set a printer to duplex mode?

Answer:

You typically switch a printer to duplex mode by changing its TDeviceMode(API: 
DEVMODE)record .But first you should test whether the installed printer driver 
supports this: 

1   uses
2     printers, winspool;
3   
4   function PrinterSupportsDuplex: Boolean;
5   var
6     Device, Driver, Port: array[0..255] of Char;
7     hDevMode: THandle;
8   begin
9     Printer.GetPrinter(Device, Driver, Port, hDevmode);
10    Result := WinSpool.DeviceCapabilities(Device, Port, DC_DUPLEX, nil, nil) <> 0;
11  end;


If it does you can try to switch the duplex mode on before you call  
richedit.print: 

12  var
13    Device, Driver, Port: array[0..80] of Char;
14    DevMode: THandle;
15    pDevmode: PDeviceMode;
16  begin
17    // Get printer device mode handle.
18    Printer.GetPrinter(Device, Driver, Port, DevMode);
19    if Devmode <> 0 then
20    begin
21      // lock it to get pointer to DEVMODE record
22      pDevMode := GlobalLock(Devmode);
23      if pDevmode <> nil then
24      try
25        with pDevmode^ do
26        begin
27          dmDuplex := DMDUP_VERTICAL;
28          dmFields := dmFields or DM_DUPLEX;
29        end;
30      finally
31        // unlock devmode handle.
32        GlobalUnlock(Devmode);
33      end;
34    end; { If }
35  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC