Environment.UserInteractive プロパティ

定義

現在のプロセスがユーザー対話モードで実行されているかどうかを示す値を取得します。

public:
 static property bool UserInteractive { bool get(); };
public static bool UserInteractive { get; }
static member UserInteractive : bool
Public Shared ReadOnly Property UserInteractive As Boolean

プロパティ値

true 現在のプロセスがユーザー対話モードで実行されている場合。それ以外の場合は false

次の例では、現在のプロセスがユーザー対話モードで実行されているかどうかを表示します。

// Sample for the Environment.UserInteractive property
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
    Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive);
    }
}
/*
This example produces the following results:

UserInteractive: True
*/
// Sample for the Environment.UserInteractive property
open System

printfn $"\nUserInteractive: {Environment.UserInteractive}"

// This example produces the following results:
//     UserInteractive: True
' Sample for the Environment.UserInteractive property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive)
   End Sub
End Class
'
'This example produces the following results:
'
'UserInteractive: True
'

注釈

UserInteractive プロパティは、Windows プロセスまたはユーザー インターフェイスなしで実行される IIS などのサービスのfalseを報告します。 このプロパティが falseされている場合は、ユーザーが操作するグラフィカル ユーザー インターフェイスがないため、モーダル ダイアログやメッセージ ボックスを表示しないでください。

適用対象

こちらもご覧ください