示例#1
0
        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);
        }
示例#2
0
 bool GetVersionEx(
     [marshal(UnmanagedType.LPStruct)]
     OSVERSIONINFO osvi);
示例#3
0
        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 ) ;
        }