Solved

Printer Drivers

Posted on 2001-06-03
2
221 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

16 Experts available now in Live!

Get 1:1 Help Now