Solved

Unload Screensaver in NT4 svp3??

Posted on 1998-07-17
3
235 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

758 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

18 Experts available now in Live!

Get 1:1 Help Now