ServiceController.ServiceType プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ServiceController.ServiceType プロパティの意味・解説 

ServiceController.ServiceType プロパティ

対象となるオブジェクト参照するサービスの種類取得します

名前空間: System.ServiceProcess
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

Public ReadOnly Property
 ServiceType As ServiceType
Dim instance As ServiceController
Dim value As ServiceType

value = instance.ServiceType
public ServiceType ServiceType { get; }
public:
property ServiceType ServiceType {
    ServiceType get ();
}
/** @property */
public ServiceType get_ServiceType ()
public function get ServiceType
 () : ServiceType

プロパティ
ネットワーク サービスの種類を示すために使用する ServiceType 値の 1 つ

例外例外
解説解説
使用例使用例

ServiceController クラス使用してローカル コンピュータデバイス ドライバ サービス表示する例を次に示します

Dim scDevices() As ServiceController
scDevices = ServiceController.GetDevices()

Dim numAdapter As Integer
Dim numFileSystem As Integer
Dim numKernel As Integer
Dim numRecognizer As Integer

' Display the list of device driver services.
Console.WriteLine("Device driver services on the local computer:")

Dim scTemp As ServiceController
For Each scTemp In  scDevices
   ' Display the status and the service name, for example,
   '   [Running] PCI Bus Driver
   '             Type = KernelDriver

   Console.WriteLine(" [{0}] {1}", scTemp.Status,
 scTemp.DisplayName)
   Console.WriteLine("           Type = {0}", scTemp.ServiceType)

   ' Update counters using the service type bit flags.
   If (scTemp.ServiceType And ServiceType.Adapter)
 <> 0 Then
      numAdapter = numAdapter + 1
   End If
   If (scTemp.ServiceType And ServiceType.FileSystemDriver)
 <> 0 Then
      numFileSystem = numFileSystem + 1
   End If
   If (scTemp.ServiceType And ServiceType.KernelDriver)
 <> 0 Then
      numKernel = numKernel + 1
   End If
   If (scTemp.ServiceType And ServiceType.RecognizerDriver)
 <> 0 Then
      numRecognizer = numRecognizer + 1
   End If

Next scTemp

Console.WriteLine()
Console.WriteLine("Total of {0} device driver services",
 scDevices.Length)
Console.WriteLine("  {0} are adapter drivers", numAdapter)
Console.WriteLine("  {0} are file system drivers",
 numFileSystem)
Console.WriteLine("  {0} are kernel drivers", numKernel)
Console.WriteLine("  {0} are file system recognizer drivers",
 numRecognizer)

ServiceController[] scDevices;
scDevices = ServiceController.GetDevices();

int numAdapter = 0,
    numFileSystem = 0, 
    numKernel = 0, 
    numRecognizer = 0;
       
// Display the list of device driver services.
Console.WriteLine("Device driver services on the local computer:");

foreach (ServiceController scTemp in scDevices)
{
   // Display the status and the service name, for example,
   //   [Running] PCI Bus Driver
   //             Type = KernelDriver

   Console.WriteLine(" [{0}] {1}", 
                     scTemp.Status, scTemp.DisplayName);
   Console.WriteLine("           Type = {0}", scTemp.ServiceType); 

   // Update counters using the service type bit flags.
   if ((scTemp.ServiceType & ServiceType.Adapter) != 0)
   {
      numAdapter++;
   } 
   if ((scTemp.ServiceType & ServiceType.FileSystemDriver)
 != 0)
   {
      numFileSystem++;
   }  
   if ((scTemp.ServiceType & ServiceType.KernelDriver) !=
 0)
   {
      numKernel++;
   } 
   if ((scTemp.ServiceType & ServiceType.RecognizerDriver)
 != 0)
   {
      numRecognizer++;
   }

}

Console.WriteLine();
Console.WriteLine("Total of {0} device driver services", scDevices.Length);
Console.WriteLine("  {0} are adapter drivers", numAdapter);
Console.WriteLine("  {0} are file system drivers", numFileSystem);
Console.WriteLine("  {0} are kernel drivers", numKernel);
Console.WriteLine("  {0} are file system recognizer drivers", numRecognizer);

array<ServiceController^>^scDevices = ServiceController::GetDevices();
if ( scDevices->Length )
{
   int numAdapter = 0,numFileSystem = 0,numKernel = 0,numRecognizer
 = 0;

   // Display the list of device driver services.
   Console::WriteLine(  "Device driver services on the local computer:"
 );

   for each (ServiceController^ scTemp in scDevices)
   {
      // Display the status and the service name, for example,
      //   [Running] PCI Bus Driver
      //             Type = KernelDriver
      Console::WriteLine(  " [{0}] {1}", scTemp->Status, scTemp->DisplayName
 );
      Console::WriteLine(  "           Type = {0}", scTemp->ServiceType
 );

      // Update counters using the service type bit flags.
      if ( (scTemp->ServiceType & ServiceType::Adapter)
 != (ServiceType)0 )
      {
         numAdapter++;
      }
      if ( (scTemp->ServiceType & ServiceType::FileSystemDriver)
 != (ServiceType)0 )
      {
         numFileSystem++;
      }
      if ( (scTemp->ServiceType & ServiceType::KernelDriver)
 != (ServiceType)0 )
      {
         numKernel++;
      }
      if ( (scTemp->ServiceType & ServiceType::RecognizerDriver)
 != (ServiceType)0 )
      {
         numRecognizer++;
      }
   }
   Console::WriteLine();
   Console::WriteLine(  "Total of {0} device driver services", scDevices->Length.ToString()
 );
   Console::WriteLine(  "  {0} are adapter drivers", numAdapter.ToString()
 );
   Console::WriteLine(  "  {0} are file system drivers", numFileSystem.ToString()
 );
   Console::WriteLine(  "  {0} are kernel drivers", numKernel.ToString()
 );
   Console::WriteLine(  "  {0} are file system recognizer drivers", numRecognizer.ToString()
 );
ServiceController scDevices[];
scDevices = ServiceController.GetDevices();

int numAdapter = 0;
int numFileSystem = 0;
int numKernel = 0;
int numRecognizer = 0;
// Display the list of device driver services.
Console.WriteLine("Device driver services on the local computer:");
ServiceController scTemp = null;
for (int iCtr = 0; iCtr < scDevices.get_Length();
 iCtr++) {
    // Display the status and the service name, for example,
    // [Running] PCI Bus Driver
    // Type = KernelDriver
    scTemp = scDevices[iCtr];

    Console.WriteLine(" [{0}] {1}", scTemp.get_Status(), 
        scTemp.get_DisplayName());
    Console.WriteLine("           Type = {0}", 
        scTemp.get_ServiceType());
    // Update counters using the service type bit flags.
    if (System.Convert.ToInt32(scTemp.get_ServiceType() &
        ServiceType.Adapter) != 0) {
        numAdapter++;
    }
    if ((System.Convert.ToInt32(scTemp.get_ServiceType() &
 
        ServiceType.FileSystemDriver)) != 0) {
        numFileSystem++;
    }
    if (System.Convert.ToInt32((scTemp.get_ServiceType() &
 
        ServiceType.KernelDriver)) != 0) {
        numKernel++;
    }
    if (System.Convert.ToInt32((scTemp.get_ServiceType() &
 
        ServiceType.RecognizerDriver)) != 0) {
        numRecognizer++;
    }
}

Console.WriteLine();
Console.WriteLine("Total of {0} device driver services", 
    System.Convert.ToString(scDevices.get_Length()));
Console.WriteLine("  {0} are adapter drivers", 
    System.Convert.ToString(numAdapter));
Console.WriteLine("  {0} are file system drivers", 
    System.Convert.ToString(numFileSystem));
Console.WriteLine("  {0} are kernel drivers", 
    System.Convert.ToString(numKernel));
Console.WriteLine("  {0} are file system recognizer drivers", 
    System.Convert.ToString(numRecognizer));
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ServiceController クラス
ServiceController メンバ
System.ServiceProcess 名前空間
ServiceType



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ServiceController.ServiceType プロパティ」の関連用語

ServiceController.ServiceType プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ServiceController.ServiceType プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS