[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Unload Screensaver in NT4 svp3??

I created a "slide-show" type screensaver in VB3 a long time ago.
 It basically loads a form with a picturebox and then loads a series of 10
bitmaps one after the other with a series of transition effects (fade, wipe, etc). It has
always worked great in Win 3.x, and then also in Win95. I created a VB4 32bit
version of it last year and have used it also without any problems on Windows 95.

This week I put it on my NT4 workstation and was suprised to see that when I
move the mouse or hit a key to clear the screensaver, it does not return me
to my desktop, but leaves me with a blank screen (like it didn't refresh or something).
To restore the screen I only need to CTRL ALT DEL and then cancel.

Something is preventing the screensaver from totally unloading. This same problem
happens with my VB3 and my VB4 32bit version. I downloaded a couple of the sample codes floating around the Net for ssavers in VB4 and added my "slideshow" code into it and got the same results.

Has anyone else experienced this same problem? Or am I missing something new that NT is doing? Maybe a new way to unload a ssaver?

Any help, information or sample code would be greatly appreciated.

Sincerely,

-S
0
summerset
Asked:
summerset
  • 2
1 Solution
 
gissingCommented:
NT 4 screensavers don't work the same as they do on 16 bit windows or windows 95. They don't run on the main desktop, they run on a special desktop all of their own. Although I have never written a screensaver myself, I have written an application which has had to terminate a screensaver if it was running. My application had to work on 95 and NT 4. Here is my code:

/// KillScreenSaverFunc ////////////////////////////////////////////////////////
//
//
////////////////////

static BOOL CALLBACK KillScreenSaverFunc( HWND hwnd, LPARAM lParam )
{
    PostMessage( hwnd, WM_CLOSE, 0, 0 );
    return TRUE;
}


/// CMBSClientApp::KillScreenSaver /////////////////////////////////////////////
//
//  Purpose:
//      kill the screensaver if it is currently running
//  Note:
//      handles NT/95 differences
//
////////////////////

void CMBSClientApp::KillScreenSaver()
{
    //
    //  are we on Windows 95?
    //

    if( m_osVersion.IsWin95() )
    {
        //
        //  yes, so kill the screensaver appropriately
        //
   
        LogDbg( "Killing Windows 95 screensaver" );
       
        HWND hwndSS = FindWindow( "WindowsScreenSaverClass", NULL );
        if( hwndSS )
            SendMessage( hwndSS, WM_CLOSE, 0, 0L );
    }
    else
    {
        LogDbg( "Killing Windows NT screensaver" );

        //
        //  no, assume NT and killing the screensaver is
        //  a bit more involved
        //

        HDESK hdesk;    //  handle to the screensaver desktop

        //
        //  Attempt to get a handle to the screensaver desktop
        //

        hdesk = OpenDesktop( TEXT("Screen-saver"),
                             0,
                             FALSE,
                             DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS);

        //
        //  bundle through the windows in the screensaver desktop and close them all
        //

        if( hdesk )
        {
            EnumDesktopWindows(hdesk, (WNDENUMPROC)KillScreenSaverFunc, 0);
            CloseDesktop(hdesk);
        }
    }
}

Although the code is in C++, I'm sure you'll get the idea.

i hope this helps.
0
 
summersetAuthor Commented:
Thanks for the lead. It helped me find more information which helped me to solve the problem. Check out MS KB Article Q140723. I was also suprised that there wasn't more documentation on this. Also -- I had to rebuild the program in VB5 before It would work. I assume this is VB4's limitations on callbacks.

I gave you a "B" because your sample was in C not VB.

Thanks again!!

-S
0
 
summersetAuthor Commented:
Thanks for the lead. It helped me find more information which helped me to solve the problem. Check out MS KB Article Q140723. I was also suprised that there wasn't more documentation on this. Also -- I had to rebuild the program in VB5 before It would work. I assume this is VB4's limitations on callbacks.

I gave you a "B" because your sample was in C not VB.

Thanks again!!

-S
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now