Solved

Unload Screensaver in NT4 svp3??

Posted on 1998-07-17
3
236 Views
Last Modified: 2010-05-03
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
Comment
Question by:summerset
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
gissing earned 100 total points
ID: 1466077
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
 

Author Comment

by:summerset
ID: 1466078
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
 

Author Comment

by:summerset
ID: 1466079
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now