Export (0) Print
Expand All

Environment.UserInteractive Property

Gets a value indicating whether the current process is running in user interactive mode.

[Visual Basic]
Public Shared ReadOnly Property UserInteractive As Boolean
[C#]
public static bool UserInteractive {get;}
[C++]
public: __property static bool get_UserInteractive();
[JScript]
public static function get UserInteractive() : Boolean;

Property Value

true if the current process is running in user interactive mode; otherwise, false.

Remarks

This will be false only when running as a Service Process or from inside a Web application. When this property is false, you should not display any modal dialogs or message boxes, because there is no graphical user interface for the user to interact with.

Example

[Visual Basic] 
' 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
'

[C#] 
// 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
*/

[C++] 
// Sample for the Environment::UserInteractive property
#using <mscorlib.dll>

using namespace System;

int main() {
   Console::WriteLine();
   Console::WriteLine(S"UserInteractive: {0}", __box(Environment::UserInteractive));
}
/*
This example produces the following results:

UserInteractive: True
*/

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Environment Class | Environment Members | System Namespace | SystemInformation

Show:
© 2014 Microsoft