[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Darwin S

12/18/2002 6:59:00 PM

I was looking for a way to communicate with a particular
USB device. I have questions regarding that which I will
post in a separate message but while searching the SDK for
information I came across a reference to
ServiceController.GetDevices() which seemed might be
useful. The sdk documentation indicates that the
ServiceController class is in the System.ServiceProcess
namespace. However, in Visual Studio, the intellisense
does not show any ServiceProcess namespace in the System
namespace. Am I missing something?
Thanks,
Darwin
2 Answers

NETMaster

12/18/2002 8:31:00 PM

0

> ServiceController.GetDevices() which seemed might be
> useful. The sdk documentation indicates that the
> ServiceController class is in the System.ServiceProcess
> namespace.


You have to add a reference to the .NET assembly:
System.ServiceProcess.dll
see:
http://dnetm...images/vsnet_...


With 'ServiceController' you can only
start/stop and control the device-driver,
but NOT communicate with the real device.



// ====================================================
using System;
using System.ServiceProcess;

namespace ConsoleApplication
{
class Class1
{
[MTAThread]
static void Main(string[] args)
{
ServiceController[] devs = ServiceController.GetDevices();
foreach( ServiceController dev in devs )
{
Console.WriteLine( "Name : '{0}', state={1}", dev.DisplayName, dev.Status );
}

Console.WriteLine( "end." );
}
}
}
// ====================================================



--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_d... - http://dnetm...


Darwin S

12/18/2002 8:37:00 PM

0

Oh, that's right! I keep forgetting that some .NET
namespaces have to have references added before they are
available. Thank you.

I suspected the ServiceController was not the answer.

Thank you.
Darwin
>-----Original Message-----
>> ServiceController.GetDevices() which seemed might be
>> useful. The sdk documentation indicates that the
>> ServiceController class is in the System.ServiceProcess
>> namespace.
>
>
>You have to add a reference to the .NET assembly:
> System.ServiceProcess.dll
>see:
> http://dnetm...images/vsnet_...
>
>
>With 'ServiceController' you can only
>start/stop and control the device-driver,
>but NOT communicate with the real device.
>
>
>
>// ====================================================
> using System;
> using System.ServiceProcess;
>
> namespace ConsoleApplication
> {
> class Class1
> {
> [MTAThread]
> static void Main(string[] args)
> {
> ServiceController[] devs =
ServiceController.GetDevices();
> foreach( ServiceController dev in devs )
> {
> Console.WriteLine( "Name : '{0}', state={1}",
dev.DisplayName, dev.Status );
> }
>
> Console.WriteLine( "end." );
> }
> }
> }
>// ====================================================
>
>
>
>--
> Thomas Scheidegger - MVP .NET - 'NETMaster'
> http://www.cetus-links.org/oo_d... -
http://dnetm...
>
>
>.
>