View Single Post
Old 06-09-2007   #2 (permalink)
Bob


 
 

RE: Getting the default printer in 64-bit Vista

Hi Mark,

You will ahve to get 64 bit drivers for your printer. Canon have the drivers
so I would have to assume that HP would have too.

"Mark Rae" wrote:

> Hi,
>
> I have used the code below to return the default printer in 32-bit WinXP
> Pro, but now that I am running 64-bit Vista Business I'm getting an error:
>
> using System.Drawing.Printing;
>
> using (PrintDocument objPrintDocument = new PrintDocument())
> {
> string strDefaultPrinter =
> objPrintDocument.PrinterSettings.PrinterName;
> }
>
> The error message is: "No printers are installed." and which seems to come
> from a method called HdevmodeInternal
>
> However, I have several printers installed, and the default printer is an
> old HP LaserJet 5.
>
> Does the above code not work on 64-bit Vista? The app in question is
> compiled for x86...
>
> Would I be better off using WMI to return the name of the default printer?
>
> I've tried to find a solution in Google and MSDN, but haven't had much
> luck...
>
> Any assistance gratefully received.
>
>
> --
> http://www.markrae.net
>
>

My System SpecsSystem Spec