Impossible = “Somebody else’s PERL”
Archive for March, 2008
Keywords: Microsoft Printer Automation, .Net Printer Settings, COM Printer Settings
So you want to set the default printer on your windows system? Or maybe you want to install a printer on the fly, or change a printer’s settings?
Oh, and you want to do this from within a .Net program? (And I won’t even ask you “Why?” because I already know: it’s because you have a job ;-)
While I am not aware of any APIs that do this natively in the .Net world, there is a nifty DLL that you can get from Microsoft called prnadmin.dll. It may already be installed somewhere on your system, but if not, you can get it from Microsoft as part of the Windows 2000 or 2003 Server Resource Kit. This DLL exposes a number of COM APIs that do many useful things with printers and printer settings.
(Update: See my CodeProject Article about using PRNADMIN.DLL)