screensaver under windows nt workstation 4.0

screensaver under windows nt workstation 4.0

Post by wbia.. » Thu, 09 Oct 1997 04:00:00



Hello to all :)

Is there a function inside win32 to determine if the screensaver is activ and runnig ????

with the best greetings from switzerland
H.Weber

 
 
 

screensaver under windows nt workstation 4.0

Post by Patrik Blomber » Thu, 09 Oct 1997 04:00:00


Quote:> Is there a function inside win32 to determine if the screensaver is activ and runnig ????

No, but it's not that hard to implement yourself. Look up
kb-article Q150785 "How to Detect If a Screen Saver Is
Running on Windows NT" for more info.

   BOOL
   IsScreenSaverRunning(
       void
       )
   {
       HDESK hDesktop;
       hDesktop = OpenDesktop(
           TEXT("screen-saver"),
           0,
           FALSE,
           MAXIMUM_ALLOWED
           );
       if(hDesktop == NULL) {
           if(GetLastError() == ERROR_ACCESS_DENIED)
               return TRUE;
           return FALSE;
       }
       CloseDesktop(hDesktop);
       return TRUE;
   }

Cheers,
Patrik

------
If replying by email, remove the spam protection stuff ".---",
at the end of my return address.

 
 
 

screensaver under windows nt workstation 4.0

Post by Jon Bo » Fri, 10 Oct 1997 04:00:00


We are launching a screen saver from VB, and then trying to detect when it
goes away.  I had found the KB article of which you had referred, and I
always get the NULL handle from OpenDesktop AND a zero from GetLastError
(using NT 4.0, tried VB and then VC).  I came here looking for help, and
found your discussion.  Am I doing something wrong?

Thanks for any direction

Jon Box

www.innovativecomm.com

 
 
 

screensaver under windows nt workstation 4.0

Post by John Morris » Sat, 11 Oct 1997 04:00:00



Quote:

> Jon,

> All I have is a kluge:

*** code snip ***

Quote:> -----------------------------------------------------------------------------

> To try this, run the program in a prompt window; within the 15 seconds
> that it runs, lock the WS, leave at least 1 sec locked, unlock, view
> the results.

> While the WS is unlocked, the imput desktop is "Default"; when it's
> locked, we get slapped on the wrist. Same if the logon desktop is
> active, but when that happens, normal programs don't run.

> I could have added myself to the screen saver and logon desktop ACLs,
> to get the right to query them -- but that would have required admin
> priv; therefore I decided to make use of the wrist-slap -- it tells
> you whether the currently active ("input") desktop is usable for your
> program.

> Cheers,
> Felix.

How can you add yourself to the logon desktop ACL - I want to switch to
that desktop, this will, I _think_, lock the workstation?

J.

 
 
 

screensaver under windows nt workstation 4.0

Post by Felix Kasza [MV » Sat, 11 Oct 1997 04:00:00


Jon,

All I have is a kluge:

-------------------------------------------------------------------------
#include <windows.h>
#include <stdio.h>

#pragma hdrstop

int main( void )
{
        HDESK h;
        int i;
        char buf[256];
        DWORD needed;

        for ( i = 0; i < 15; i ++ )
        {
                if ( i > 0 )
                        Sleep( 1000 );

                h = OpenInputDesktop( 0, 0, DESKTOP_ENUMERATE );
                if ( h == NULL )
                        printf( "%d: OID(): GLE() = %lu\n", i, GetLastError() );
                else
                {
                        if ( ! GetUserObjectInformation( h, UOI_NAME,
                          (void *) buf, sizeof buf, &needed ) )
                                printf( "%d: GUOI(): GLE() = %lu\n",
                                  i, GetLastError());
                        else
                                printf( "%d: Desktop: %s\n", i, buf );
                        CloseHandle( h );
                }
        }
        return 0;

Quote:}

-----------------------------------------------------------------------------

To try this, run the program in a prompt window; within the 15 seconds
that it runs, lock the WS, leave at least 1 sec locked, unlock, view
the results.

While the WS is unlocked, the imput desktop is "Default"; when it's
locked, we get slapped on the wrist. Same if the logon desktop is
active, but when that happens, normal programs don't run.

I could have added myself to the screen saver and logon desktop ACLs,
to get the right to query them -- but that would have required admin
priv; therefore I decided to make use of the wrist-slap -- it tells
you whether the currently active ("input") desktop is usable for your
program.

Cheers,
Felix.

--
If you post a reply, kindly refrain from emailing it, too.

 
 
 

screensaver under windows nt workstation 4.0

Post by Jon Bo » Sat, 11 Oct 1997 04:00:00




Quote:

> We are launching a screen saver from VB, and then trying to detect when
it
> goes away.  I had found the KB article of which you had referred, and I
> always get the NULL handle from OpenDesktop AND a zero from GetLastError
> (using NT 4.0, tried VB and then VC).  I came here looking for help, and
> found your discussion.  Am I doing something wrong?

I have now found that if NT starts the screen saver b/c of inactivity, the
KB example and Patrick's code work.  But if I start the screen saver by
double clicking in Explorer ( or by ScrnSaver.Exe /S), the OpenDesktop
fails.  I am guessing that when started in this fashion, the screen saver
is running under the user's desktop.

Jon Box

 
 
 

1. Connecting Windows 95 and Windows Workstation NT 4.0

Hi All,

I'm trying to connect to computers using their serial/paralel ports. One
has Windows 95 and the other Windows Wkstation 4.0. Does anyone
have an idea how can I do that ?? I know NT 4.0 doesn't have DCC ( Direct
Cabel Connectio ), so what are the other ways to do that ?? Can I a use
the paralel port of one and the serial port the other ?? How can I find
which
COM is assigned to each port and if it's in use or no ?? ( I'm having
some problems to find out which port should I use .. )

Thanks in Advance
Renato, Brazil.

2. Help in ATM

3. Is it possible to install remote TSP server on Windows NT 4.0 Workstation?

4. Search flood sensor ...

5. Visual C++ 4.0 Install on Windows NT workstation 3.5 ???

6. How we can start .NET

7. porting an OS/2-Presentation Manager application to Windows NT 4.0 workstation

8. How do I create user with permissions to Join Computer to Domain?

9. How to reboot Windows NT 4.0 Workstation?

10. FTP over RAS (Windows NT 4.0 Workstation).

11. Locking a Windows NT 4.0 Workstation by code

12. WINDOWS NT 4.0 WORKSTATION RESOURCE KIT

13. How to differentiate between Win NT 4.0 workstation and NT server