Board index » delphi » Refresh Printer.Printers List?

Refresh Printer.Printers List?

I have an application that installs the print driver (actually a fax
driver) if it does not
already exist on a system. I determine if  the driver is installed via
the Delphi Printers unit, examining the Printer.Printers list. If the
driver does not appear in the list then I install it, but later on I
want to print to this driver so I go to look for the correct
PrinterIndex. The driver that I just installed does not appear until I
restart the application. After a restart there is no problem.

How can I refresh the Printer.Printers list immediately after installing
the printer driver?

 

Re:Refresh Printer.Printers List?


"Todd Kofford" <tkoff...@sunflower.com> skrev i en meddelelse
news:38D63E2E.AC3A0687@sunflower.com...

Quote
> How can I refresh the Printer.Printers list immediately after installing
> the printer driver?

What about this?
  Printer.Refresh;

Finn Tolderlund

Re:Refresh Printer.Printers List?


That would be nice if Refresh was available, but this causes a compiler error.
Quote
Finn Tolderlund wrote:
> "Todd Kofford" <tkoff...@sunflower.com> skrev i en meddelelse
> news:38D63E2E.AC3A0687@sunflower.com...
> > How can I refresh the Printer.Printers list immediately after installing
> > the printer driver?

> What about this?
>   Printer.Refresh;

> Finn Tolderlund

Re:Refresh Printer.Printers List?


Quote
In article <38D65F97.95A6D...@sunflower.com>, Todd Kofford wrote:
> That would be nice if Refresh was available, but this causes a compiler error.

It definitely is available, at least in D5.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:Refresh Printer.Printers List?


I have D4 and refresh is not part of the list of method in the help file. It shows
BeginDoc , EndDoc, Abort etc.., but no ReFresh

Davie
P.S. So, maybe the guy needs a different solution :(

Quote
"Peter Below (TeamB)" wrote:
> In article <38D65F97.95A6D...@sunflower.com>, Todd Kofford wrote:
> > That would be nice if Refresh was available, but this causes a compiler error.

> It definitely is available, at least in D5.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Re:Refresh Printer.Printers List?


Quote
In article <38D65F97.95A6D...@sunflower.com>, Todd Kofford wrote:
> That would be nice if Refresh was available, but this causes a compiler error.

That should teach you to always mention which Delphi version you are using. If
you don't we assume the latest.

You can force a rebuild of the printer list the hard way with

  Printer.Free;
  SetPrinter( TPrinter.Create );

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:Refresh Printer.Printers List?


Thanks for the help, it worked! BTW, I'm using Delphi 3 and will mention version
information in any future posts.

Quote
"Peter Below (TeamB)" wrote:
> In article <38D65F97.95A6D...@sunflower.com>, Todd Kofford wrote:
> > That would be nice if Refresh was available, but this causes a compiler error.

> That should teach you to always mention which Delphi version you are using. If
> you don't we assume the latest.

> You can force a rebuild of the printer list the hard way with

>   Printer.Free;
>   SetPrinter( TPrinter.Create );

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

--
Todd Kofford
tkoff...@bgint.com

Other Threads