Solved

Unload Screensaver in NT4 svp3??

Posted on 1998-07-17
3
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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