DelphiFan Magazine

Top Menu

Main Menu

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS

logo

DelphiFan Magazine

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS
  • How to add a server application written in UNIGUI to startup?

  • UniGUI Expiry Link Anonymizer

  • UniGUI Add CAPTCHA to the WEB project

  • UniGui. Unique hybrid of Delphi and JS

  • How to transform a blob field into string lines (varchar) in SQL Firebird?

CODE SAMPLESDELPHI
Home›CODE SAMPLES›How to select a printer installed in Windows?

How to select a printer installed in Windows?

By admin
January 7, 2021
544
0
Share:

In system configurations it is very common to have to inform

a standard printer to automate some task.

Right. We can manually enter the printer share name
or we can create a way for the user to choose easily.

Using TPrinterDialog, the system will make use of Windows’ own search!

Let’s go to the code!

I will put the whole unit to facilitate understanding.

 

unit Unit2;
 
interface
 
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
 
type
  TForm2 = class(TForm)
    Button1: TButton;
    PrintDialog1: TPrintDialog;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var 
  Form2 : TForm2 ;
 
implementation
 
{$R *.dfm}
 
uses 
  {Very important to declare this unit} 
  Vcl . Printers ;
 
procedure TForm2 . Button1Click ( Sender :  TObject ) ; 
begin 
  if PrintDialog1 . Run  then 
  begin 
    // Displaying the selected printer !!! 
    ShowMessage ( 
      Printer . Printers [ Printer . PrinterIndex  ] ) ; 
  end ; 
end ;
 
end.

So we can see at the click of a button the printer selects, making it
much easier for the end user.

Tagsdelphiprinterselect printerwindows printer
Previous Article

How to select multiple files with OpenDialog?

Next Article

Internationalizing your application in Delphi

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

admin

Related articles More from author

  • DELPHIVIDEOS

    Android Permissions in Delphi

    October 2, 2020
    By admin
  • DELPHIFIREMONKEY

    Opening a Pdf File With Delphi (Android)

    October 6, 2020
    By admin
  • CODE SAMPLESDELPHI

    Connect And Manage A SQLite Database For Delphi

    October 8, 2020
    By admin
  • CODE SAMPLESDELPHI

    How does Delphi install and configure third-party controls and deal with file not found

    October 30, 2020
    By admin
  • CODE SAMPLESDELPHI

    How to set up Unigui to run on Linux Operating System

    October 11, 2020
    By admin
  • CODE SAMPLESDELPHI

    Use LockBox does encryption and decryption

    January 2, 2021
    By admin

Leave a reply Cancel reply

You may interested

  • CODE SAMPLESDELPHI

    Use LockBox does encryption and decryption

  • CODE SAMPLESDELPHI

    UniGUI Expiry Link Anonymizer

  • CODE SAMPLESDELPHI

    Good code samples for cxGrid

  • LATEST REVIEWS

  • TOP REVIEWS

Timeline

  • January 27, 2021

    How to add a server application written in UNIGUI to startup?

  • January 27, 2021

    UniGUI Expiry Link Anonymizer

  • January 26, 2021

    UniGUI Add CAPTCHA to the WEB project

  • January 26, 2021

    UniGui. Unique hybrid of Delphi and JS

  • January 13, 2021

    How to transform a blob field into string lines (varchar) in SQL Firebird?

Latest Comments

Find us on Facebook

Follow Us on Instagram

logo

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.

About us

  • 660 Pennsylvania Avenue Southeast #100 Washington, DC 20003
  • 0123456789
  • adsdelphi@gmail.com
  • Recent

  • Popular

  • Comments

  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • UniGUI Expiry Link Anonymizer

    By admin
    January 27, 2021
  • UniGUI Add CAPTCHA to the WEB project

    By admin
    January 26, 2021
  • UniGui. Unique hybrid of Delphi and JS

    By admin
    January 26, 2021
  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • Amazing Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

    By admin
    August 13, 2020
  • Critical Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux

    By admin
    September 4, 2020
  • Setting up the IDE for your first Android Application in Delphi

    By admin
    September 7, 2020

Follow us

Find us on Facebook

© Copyright Delphifan Forum. All rights reserved.