Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Printer

Status
Not open for further replies.

BorlandGeek

Programmer
Jun 14, 2004
27
CA
I need to find out how to see the name of the Default Printer on my machine from a service... all I need is the name. I think there is a few ways but i dont know what they are?
Thanks
 
Have a look at the EnumPrinters API function, and the PRINTER_INFO_2 structure.
 
It seems as if when you are trying to find your default printer from a service app it wont find it... i tried the same code in a normal app and it found the printer with no problems.. same code in a service fails.. does anyone know why?
 
Code:
...
#include <printers.hpp>
...
void __fastcall TForm1::FormCreate (TObject *Sender)
{
   AnsiString DefPrinter = Printer()->Printers->Strings[Printer()->PrinterIndex];
}

I think all you need is here.

--- LastCyborg ---
 
Sorry guys i figured it out.. you actually cant have a create form in a service.. in the service you have to log on as yourself to have a default printer work for you.
Thanks for the ideas though they kept me going!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top