public static bool GetUserObjectInformationFlags( int hObj, USEROBJECTFLAGS uof) { int Needed = 0 ; return ( InternalGetUserObjectInformationFlags ( hObj , UOI_FLAGS , uof , Marshal.SizeOf ( uof ) , Needed ) ); }
private bool IsInteractiveUser( ) { bool RetVal = true; OSVERSIONINFO osvi = new OSVERSIONINFO( ); BugslayerWin32.GetVersionEx(osvi); // If it's not NT, it's one of those "other" OSes which is // always interactive. if (OSVERSIONINFO.VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) { // Get the windows station this process is spinning on. int hStation = BugslayerWin32.GetProcessWindowStation( ); if (0 != hStation) { USEROBJECTFLAGS uof = new USEROBJECTFLAGS( ); if (true == BugslayerWin32.GetUserObjectInformationFlags(hStation, uof)) { return(USEROBJECTFLAGS.WSF_VISIBLE == (USEROBJECTFLAGS.WSF_VISIBLE & uof.dwFlags)); } else { // Assume the worst. RetVal = false; } } else { // Some kind of serious error so play it safe.... RetVal = false; } } return(RetVal); }
private bool IsInteractiveUser( ) { bool RetVal = true ; OSVERSIONINFO osvi = new OSVERSIONINFO ( ) ; BugslayerWin32.GetVersionEx ( osvi ) ; // If it's not NT, it's one of those "other" OSes which is // always interactive. if ( OSVERSIONINFO.VER_PLATFORM_WIN32_NT == osvi.dwPlatformId ) { // Get the windows station this process is spinning on. int hStation = BugslayerWin32.GetProcessWindowStation ( ) ; if ( 0 != hStation ) { USEROBJECTFLAGS uof = new USEROBJECTFLAGS ( ) ; if ( true == BugslayerWin32.GetUserObjectInformationFlags ( hStation , uof )) { return ( USEROBJECTFLAGS.WSF_VISIBLE == (USEROBJECTFLAGS.WSF_VISIBLE & uof.dwFlags)); } else { // Assume the worst. RetVal = false ; } } else { // Some kind of serious error so play it safe.... RetVal = false ; } } return ( RetVal ) ; }