473,396 Members | 1,913 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,396 software developers and data experts.

Retrieving Printer informaiton

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 anyone has a sample program or can
point me in the right direction that would be great.
Sep 22 '05 #1
3 1827
I recommend you use the Management (WMI) Extensions for Visual Studio .NET
2003 Server Explorer

http://www.microsoft.com/downloads/d...displaylang=en

After install it you will be able to drag & drop the printer class into your
project and easily get printer hardware information.

HTH

Ollie Riches

"Brian" <Br***@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
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 anyone has a sample program or
can
point me in the right direction that would be great.

Sep 22 '05 #2
thanks for the info. I downloaded and installed the WMI extensions. Sorry
for sounding stupid but how do I use these extensions. Where do I get the
printer class so I can drag and drop it into my project.

"Ollie Riches" wrote:
I recommend you use the Management (WMI) Extensions for Visual Studio .NET
2003 Server Explorer

http://www.microsoft.com/downloads/d...displaylang=en

After install it you will be able to drag & drop the printer class into your
project and easily get printer hardware information.

HTH

Ollie Riches

"Brian" <Br***@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
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 anyone has a sample program or
can
point me in the right direction that would be great.


Sep 22 '05 #3
If you open and create a .Net project (I recommend trying this with a
console application), then go to 'View' and select 'Server Explorer' from
the menu you should get the 'Server Explorer' appearing inside visual studio
(on the left usually),.

Expand the drop down list for 'Servers' and you should see a list of 7 child
nodes, these will include 'Management Classes' & 'Management Events'.

If you expand the 'Management Classes' you should see alot of nodes relating
to the machine hardware.

If you right click on the 'Printers' node and select 'Generate Managed
Class' it will generate a managed class in your project usually called
'Win32_Printer.cs' and from this class you will be able to get access to
printer information.

For example to get all the printer names on the network

using System;
using ConsoleApplication1.ROOT.CIMV2;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Printer.PrinterCollection printers = Printer.GetInstances();
foreach(Printer printer in printers)
{
Console.WriteLine(printer.Name);
}
Console.ReadLine();
}
}
}

HTH

Ollie Riches

"Brian" <Br***@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
thanks for the info. I downloaded and installed the WMI extensions.
Sorry
for sounding stupid but how do I use these extensions. Where do I get the
printer class so I can drag and drop it into my project.

"Ollie Riches" wrote:
I recommend you use the Management (WMI) Extensions for Visual Studio
.NET
2003 Server Explorer

http://www.microsoft.com/downloads/d...displaylang=en

After install it you will be able to drag & drop the printer class into
your
project and easily get printer hardware information.

HTH

Ollie Riches

"Brian" <Br***@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
> 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 anyone has a sample program or
> can
> point me in the right direction that would be great.


Sep 23 '05 #4

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

Similar topics

0
by: Yaseen | last post by:
I am not sure if someone can help me, but please bare with me for a second... My problem is to retreive the Client's Printer Collection for a web application and then print to the client's default...
0
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
1
by: David Trivette | last post by:
I was wondering if anyone could help me with a MS Access 2002 issue I'm having. Problem - I created a db in Access 97 which worked just fine for several years. In the db the user can generate...
1
by: Roman Kagan | last post by:
Hi everyone, I am successful in retrieving the image from the table (.TIF), however, the retrieved file does not work. It looks like an image file - extension, size and all, but the image is not...
4
by: laurissa96 | last post by:
I have a printer that is hookup using LPT1 and is shared. I can print the report when changing to a network printer. I have deleted, reinstalled, changed drivers, left that printer installed and...
1
by: oliver james | last post by:
Having recently upgraded to Access 2002 at work, we have encountered the error message "Problem retrieving printer information for this object". Looking back through earlier posts, it appears that...
0
by: hsifelbmur | last post by:
We are writing an app that automates printing of documents of different types. These documents are printed to PostScript files, not to a printer. The app uses shellExecute with the "printto" verb...
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: Luqman | last post by:
I am using Visual studio 2008 and ASP.Net 3.5 How can I fill a combo with List of Local Printers, installed on Client Machine ? If I have to buy any Activex Control from Internet, please do...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.