Hello,
I don't think this is supported by managed code - but I could be wrong.
Anyway, take a look at the Win32 SetDefaultPrinter method
(http://msdn2.microsoft.com/en-us/library/ms535468(VS.85).aspx). You can
call it using P/Invoke.
Kind regards,
Henning Krause
"Andrew" <(E-Mail Removed)> wrote in message
news:86031ECC-1191-49CB-B18D-(E-Mail Removed)...
> Hello, friends,
>
> We need to programmatically change default printer in our c#.net 2005
> application. We tried:
>
> System.Drawing.Printing.PrinterSettings oPS = new
> System.Drawing.Printing.PrinterSettings();
>
> try
> {
> oPS.PrinterName = defaultPrinterName;
> }
> catch (System.Drawing.Printing.InvalidPrinterException ix)
> {
> Console.WriteLine(ix.Message);
> return false;
> }
> finally
> {
> oPS = null;
> }
>
> but, no luck. The thrid party applications, say MS Word/NotePad, still use
> previous default printer, not the new specified one.
>
> Any ideas? Thanks a lot.
>
>
|