Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

How to: Determine the User Interactive State 

The following code example demonstrates how to determine whether code is being run in a user-interactive context. If UserInteractive is false, then the code is running as a service process or from inside a Web application, in which case you should not attempt to interact with the user.

Example

// user_interactive.cpp
// compile with: /clr
using namespace System;

int main() 
{
   if ( Environment::UserInteractive )
      Console::WriteLine("User interactive");
   else
      Console::WriteLine("Noninteractive");
   return 0;
}

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.