Connecting Tech Pros Worldwide Forums | Help | Site Map

How do you add a printer to a w2k server using C#

ken
Guest
 
Posts: n/a
#1: Nov 15 '05
Hello Everyone,

I am trying to find out how to add a printer to a windows 2000 advance
server by using C# code.
I cannot believe how bad the MSDN subscription is when it comes to searching
for .NET framework objects!! There seems to be a big supply of objects to
get all the settings after the printer has been installed, but I cannot find
any info on how to add a printer to a server . Does anyone have an idea of
what objects to use? Any help will be appreciated.

Thank You in Advance for Your Help,
Ken


Greg Ewing [MVP]
Guest
 
Posts: n/a
#2: Nov 15 '05

re: How do you add a printer to a w2k server using C#


Ken, you should look in to using WMI, that's probably going to be your
easiest route. Here's a script that does it which will give you some
pointers and a place to start.

http://www.microsoft.com/technet/tre...g/ScrPrn01.asp

Regarding searching MSDN, I use google which works much better than the
online MSDN search. Overall I find that to be the best way to find almost
anything online.

--
Greg Ewing [MVP]
http://www.claritycon.com/


"ken" <kkoski1@mindspring.com> wrote in message
news:eV72hVaTDHA.560@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hello Everyone,
>
> I am trying to find out how to add a printer to a windows 2000 advance
> server by using C# code.
> I cannot believe how bad the MSDN subscription is when it comes to[/color]
searching[color=blue]
> for .NET framework objects!! There seems to be a big supply of objects to
> get all the settings after the printer has been installed, but I cannot[/color]
find[color=blue]
> any info on how to add a printer to a server . Does anyone have an idea of
> what objects to use? Any help will be appreciated.
>
> Thank You in Advance for Your Help,
> Ken
>
>[/color]


Jeffrey Tan[MSFT]
Guest
 
Posts: n/a
#3: Nov 15 '05

re: How do you add a printer to a w2k server using C#



Hello Kenneth,

I noticed that the similar issue was posted in several groups (places)....I
have added a reply to you at your post:
"Does .Netframework have a way to add a network printer"
If you have follow up questions, please post there and I will work with
you. Thanks.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: Kenneth Koski <kkoski1@mindspring.com>
| References: <u56aZ8zTDHA.560@TK2MSFTNGP10.phx.gbl>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: Re: How do you add a printer to a w2k server using C#
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <O7hBNm5VDHA.2360@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Date: Thu, 31 Jul 2003 12:25:48 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:173365
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hello Jim,
|
| I could not find "System.Win32" are you referring to System.Windows? I
| am using "System.Runtime.Interopservices" for most of the printer
| pieces, but I can not find the correct syntax for importing the
| AddPrinter dll.
| This is what I have , which works, for openprinter. Does anyone know
| what it would be for AddPrinter?
|
| [DllImport("winspool.Drv", EntryPoint="GetPrinterA", SetLastError=true,
| CharSet=CharSet.Ansi,ExactSpelling=true,
| CallingConvention=CallingConvention.StdCall)]
| private static extern bool GetPrinter(IntPtr hPrinter, Int32 dwLevel,
| IntPtr pPrinter, Int32 dwBuf, out Int32 dwNeeded);
|
| Thank You in Advance for Your Help,
| Ken
|
|
|
|
|
|
|
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|

Closed Thread


Similar C# / C Sharp bytes