View Single Post
Old 05-28-2009   #2 (permalink)
Alan Morris [MSFT]


 
 

Re: PaperSize not available when Run as Admin

is this a 32bit application?

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/search/?adv=1

This posting is provided "AS IS" with no warranties, and confers no rights.

"robkeithd" <guest@xxxxxx-email.com> wrote in message
news:e3a413d48d7036ec60340f977026c0f9@xxxxxx-gateway.com...
Quote:

>
> I've got a Windows app written in C# that errors out when it is Run as
> Admin. I've boiled it down to setting the PaperSize on the printer.
> I've got a test app consisting of single form with two textboxes and in
> the Shown event I have the following code:
>
> PrinterSettings ps = new PrinterSettings();
> ps.PrinterName = "Microsoft XPS Document Writer";
> textBox1.Text = ps.PrinterName;
> textBox2.Text = ps.PaperSizes.Count.ToString();
>
> When I run the app with a double click on the desktop icon I get the
> expected 106 for the count. If I right click the icon and select Run as
> Admin, the printer name is correct but the count is zero.
>
> Part of my full app relies on reading the PaperSizes so the issue of
> not finding any when running as admin is causing some problems. This
> only seems to be an issue on 64 bit Vista. Have reproduced it on two 64
> bit boxes but don't have the problem on a 32 bit Vista or XP 32 or XP
> 64.
>
> Any help on this would be greatly appreciated
>
> Thanks
>
>
> --
> robkeithd

My System SpecsSystem Spec