473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

ken
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
Nov 15 '05 #1
2 5094
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" <kk*****@mindspring.com> wrote in message
news:eV*************@TK2MSFTNGP10.phx.gbl...
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

Nov 15 '05 #2

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 <kk*****@mindspring.com>
| References: <u5*************@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: <O7**************@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!
|

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jody Burgess | last post by:
Hi; I am writing my first python program and would like to know how to change stdout to refer to my default printer or any other printer on my network. The other question is, Is there an API set...
7
by: Steve M | last post by:
Hello, I'm having problems sending information from a python script to a printer. I was wondering if someone might send me in the right direction. I wasn't able to find much by Google TIA...
3
by: Brian | last post by:
Does anyone know how I can write a program to retrieve information about printers. Not the print queues but the physical hardware printer. I want to retrieve info such as pages printed. If...
4
by: Angel Mazo | last post by:
Recently, Terminal Server was set-up by site server responsible to give remote access to some users. I tested it and application runs ok. Now users get Error # 2202 when they try to...
0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
3
by: printline | last post by:
Hello Guys I cannot print from a locally installed printer that is mapped to a windows 2003 sever. I have installed the printer locally and can print locally. I connect to the windows 2003...
2
by: =?iso-8859-1?Q?Vicente_Garc=EDa?= | last post by:
Hello all, I have an a bit strange printer and I would like to connect a C# program running on my computer to the printer. I know that the printer can be connected by LAN (TCP/IP protocol,...
1
by: ekynox | last post by:
Hi guys, have been playing with WMI to add a network printer connection to a Windows XP pc. My environment consists of a server running Windows Server 2003 and Visual Studio 2005 and a test pc...
9
by: id10t error | last post by:
Hello, I am going to be using a Symbol WT4090 to scan items. I need to printer a tag from the Zebra ql320 plus. I am trying to do this is Visual basic 2005. Does anyone know and good site to...
2
by: wassimdaccache | last post by:
Dear all I am using windows server 2003 sp1. I am connecting a printer called BIRCH prp080 to my pc using the serial port. the printer is working well when I install the driver but the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.