Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista General

Vista - Getting the default printer in 64-bit Vista

Reply
 
Old 06-08-2007   #1 (permalink)
Mark Rae


 
 

Getting the default printer in 64-bit Vista

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
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
Old 06-10-2007   #3 (permalink)
Mark Rae


 
 

Re: Getting the default printer in 64-bit Vista

"Bob" <Bob@discussions.microsoft.com> wrote in message
news:87436CE8-9A78-479B-B542-51CC4E58FBF3@microsoft.com...

> You will ahve to get 64 bit drivers for your printer.


I'm obviously using 64-bit drivers...

> so I would have to assume that HP would have too.


They do...

It's a known bug:
http://connect.microsoft.com/VisualS...dbackID=242908


--
http://www.markrae.net

My System SpecsSystem Spec
Old 06-10-2007   #4 (permalink)
Bob


 
 

Re: Getting the default printer in 64-bit Vista

Hmmm if that is the case it is very strange then

"Mark Rae" wrote:

> "Bob" <Bob@discussions.microsoft.com> wrote in message
> news:87436CE8-9A78-479B-B542-51CC4E58FBF3@microsoft.com...
>
> > You will ahve to get 64 bit drivers for your printer.

>
> I'm obviously using 64-bit drivers...
>
> > so I would have to assume that HP would have too.

>
> They do...
>
> It's a known bug:
> http://connect.microsoft.com/VisualS...dbackID=242908
>
>
> --
> http://www.markrae.net
>
>

My System SpecsSystem Spec
Old 06-10-2007   #5 (permalink)
Mark Rae


 
 

Re: Getting the default printer in 64-bit Vista

"Bob" <Bob@discussions.microsoft.com> wrote in message
news:93AD65BC-2262-4B3B-B235-08251AF9E3BB@microsoft.com...

> Hmmm if that is the case it is very strange then


http://groups.google.com/group/micro...470f0e411259b3


--
http://www.markrae.net

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista - default printer doesn't stay as default Vista print fax & scan
Setting a default printer for the DEFAULT USER Vista print fax & scan
Vista Printer Default Printer Issues Vista print fax & scan
Vista keeps stealing default status from default printer computer Vista networking & sharing
Re: Anybody else's default printer not staying default? Vista print fax & scan


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46