By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Automatic printer installation/creation

P: n/a
Is there a way from within a C# app to create a printer? I am looking to
automate the creation of (possibly) dozens of printers, to prevent having to
go through the "Add Printer Wizard" so many times. The app will have
access to all the info necessary as if "Add Printer Wizard" was being used, I
just need to know if there's an elegant way to do this (short of nasty
registry hacks).
May 11 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I am trying to do the same thing. I have searched the web extensivly and came
up with two examples:
http://www.developerfusion.co.uk/show/5450/2/
http://www.thescripts.com/forum/thread223709.html

they compile without errors but when I try to accually use them they both
come up with a generic error (that is of no help figuring out what is causing
the error).

"ReynoldsUser" wrote:
Is there a way from within a C# app to create a printer? I am looking to
automate the creation of (possibly) dozens of printers, to prevent having to
go through the "Add Printer Wizard" so many times. The app will have
access to all the info necessary as if "Add Printer Wizard" was being used, I
just need to know if there's an elegant way to do this (short of nasty
registry hacks).
May 16 '07 #2

P: n/a
Thanks for the reply - I think we have actually got this working now here.
We are using the Interop services, and making an API call (AddPrinter) to do
what we want. We found some additional information here:
http://www.printdistributor.com/forum/post/121

The structures referenced are explained here:
http://msdn2.microsoft.com/en-us/library/ms536023.aspx
and
http://msdn2.microsoft.com/en-us/library/ms535509.aspx

I was also able to do the reverse, namely delete the printer that I
previously created, by using the DeletePrinter function. Good luck.
"David Hogenkamp" wrote:
I am trying to do the same thing. I have searched the web extensivly and came
up with two examples:
http://www.developerfusion.co.uk/show/5450/2/
http://www.thescripts.com/forum/thread223709.html

they compile without errors but when I try to accually use them they both
come up with a generic error (that is of no help figuring out what is causing
the error).

"ReynoldsUser" wrote:
Is there a way from within a C# app to create a printer? I am looking to
automate the creation of (possibly) dozens of printers, to prevent having to
go through the "Add Printer Wizard" so many times. The app will have
access to all the info necessary as if "Add Printer Wizard" was being used, I
just need to know if there's an elegant way to do this (short of nasty
registry hacks).
May 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.