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.
> I recommend you use the Management (WMI) Extensions for Visual Studio .NET
> 2003 Server Explorer
[quoted text clipped - 14 lines]
> > can
> > point me in the right direction that would be great.
Ollie Riches - 23 Sep 2005 09:21 GMT
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
> thanks for the info. I downloaded and installed the WMI extensions.
> Sorry
[quoted text clipped - 23 lines]
>> > can
>> > point me in the right direction that would be great.