Solved

Printer Drivers

Posted on 2001-06-03
2
220 Views
Last Modified: 2010-04-06
is it posisble to right printer drivers in delphi? If so how can I go about it

thanks
0
Comment
Question by:colonna_mike
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 25 total points
ID: 6151405
no i believe its not possible,you need visualc++ etc for that..
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6151512
I'm not so sure that I have understood your question , but ...

uses WinSpool;

procedure TForm1.FormCreate(Sender: TObject);
begin
   comboPrinters.Items.Assign( Printer.Printers );
end;


procedure TForm1.Button1Click(Sender: TObject);
var
    hPrinter: THandle;
    PrtName: String;
    DriverInfo: PDriverInfo2;
    dwNeeded: DWord;
begin
    PrtName :=  comboPrinters.Text;
    OpenPrinter( PChar( PrtName ) , hPrinter , nil );
    GetPrinterDriver( hPrinter, nil, 2, DriverInfo, 0, dwNeeded );
    GetMem( DriverInfo, dwNeeded );
    if GetPrinterDriver( hPrinter, nil, 2, DriverInfo, dwNeeded, dwNeeded )
then
    begin
       Memo1.Lines.Add( IntToStr( DriverInfo.cVersion ) );  // The driver
version
       Memo1.Lines.Add( StrPas( DriverInfo.pName ) );
       Memo1.Lines.Add( StrPas( DriverInfo.pEnvironment ) );
       Memo1.Lines.Add( StrPas( DriverInfo.pDriverPath ) );
       Memo1.Lines.Add( StrPas( DriverInfo.pDataFile ) );
       Memo1.Lines.Add( StrPas( DriverInfo.pConfigFile ) );
    end
    else
        Memo1.Lines.Add( 'No Info needed = ' + IntToStr( dwNeeded ) );
    ClosePrinter( hPrinter );
    FreeMem( DriverInfo );
end;
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now