Articles   Members Online: 3
-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 identify the paper names of the active printer 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
30-Aug-02
Category
Reporting /Printing
Language
Delphi 2.x
Views
83
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to identify the paper names of the active printer

Answer:
1   
2   procedure TFReport.GetPapernames(sl: TStrings);
3   type
4     TPaperName = array[0..63] of Char;
5     TPaperNameArray = array[1..High(Integer) div Sizeof(TPaperName)] of TPaperName;
6     PPapernameArray = ^TPaperNameArray;
7   var
8     Device, Driver, Port: array[0..255] of Char;
9     hDevMode: THandle;
10    i, numPaperformats: Integer;
11    pPaperFormats: PPapernameArray;
12  begin
13    Printer.GetPrinter(Device, Driver, Port, hDevmode);
14    numPaperformats := WinSpool.DeviceCapabilities(Device, Port, DC_PAPERNAMES, nil, 
15  nil);
16    if numPaperformats > 0 then
17    begin
18      GetMem(pPaperformats, numPaperformats * Sizeof(TPapername));
19      try
20        WinSpool.DeviceCapabilities(Device, Port, DC_PAPERNAMES, 
21  Pchar(pPaperFormats), nil);
22        sl.Clear;
23        for i := 1 to numPaperformats do
24          sl.add(pPaperformats^[i]);
25      finally
26        FreeMem(pPaperformats);
27      end;
28    end;
29  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