Environment.UserInteractive Environment.UserInteractive Environment.UserInteractive Environment.UserInteractive Property

定義

取得數值,指示目前的處理程序是否正執行於使用者互動模式中。Gets a value indicating whether the current process is running in user interactive mode.

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

屬性值

true 如果目前的處理序執行於使用者互動模式;否則, falseif the current process is running in user interactive mode; otherwise, false.

範例

下列範例會顯示目前的處理序是執行於使用者互動模式。The following example displays whether the current process is running in user interactive mode.

// Sample for the Environment::UserInteractive property
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive );
}

/*
This example produces the following results:

UserInteractive: True
*/
// 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
Imports System

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

備註

UserInteractive屬性報告falseWindows 處理程序或執行不含使用者介面的 IIS 之類的服務。The UserInteractive property reports false for a Windows process or a service like IIS that runs without a user interface. 如果此屬性為false,不會顯示強制回應對話方塊或訊息方塊,因為沒有使用者互動的圖形化使用者介面。If this property is false, do not display modal dialogs or message boxes because there is no graphical user interface for the user to interact with.

適用於

另請參閱