Hopefully the following code will be of use to anyone wishing to disable screensavers and alt-tab/ctrl-esc in
                     their programs under win95 or win98 (don't know if this works under NT but try it anyway).

                     This is a copy of the WinMain function from a program I'm currently working on. As you can see I call the 
                      SystemParametersInfo function to do the work of switching these things off at the start of the program and
                     then back on again when it exits.

                     Hope this solves the debate!!

                     cheers,

                     Sol.


                     //WinMain sourcecode
                     int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                    LPSTR lpCmdLine, int nCmdShow)
                     {
                       PVOID pvParam;  //declare pvParam for  SystemParametersInfo() call
                       MSG msg;          // message
                       if (!hPrevInstance) // Other instances going
                       if (!InitApplication(hInstance))      // Initialize shared things
                             return (FALSE); // Exits if unable to initialize

                       ///turn off screensavers
                       SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,FALSE,0,0); 

                       ///turn off ALT-TAB
                     SystemParametersInfo(SPI_SCREENSAVERRUNNING,TRUE,
                                                                pvParam,0); 
                       ///turn off low power
                       SystemParametersInfo(SPI_SETLOWPOWERACTIVE,0,NULL,0); 




                       /* Perform initializations that apply to a specific instance */

                       if (!InitInstance(hInstance, nCmdShow))
                             return (FALSE);

                       /* Acquire and dispatch messages until a WM_QUIT message is received. */

                       while (GetMessage(&msg, // message structure
                             NULL, // handle of window receiving the message
                             0,    // lowest message to examine
                             0))   // highest message to examine
                       {
                       TranslateMessage(&msg); // Translates virtual key codes
                       DispatchMessage(&msg);  // Dispatches message to window
                       }
                        //turn screensaver back on
                        SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,TRUE,0,0); 
                        
                     //turn alt-tab back on
                     SystemParametersInfo(SPI_SCREENSAVERRUNNING,FALSE,
                                                              pvParam,0);
                      //turn low power back on
                     SystemParametersInfo(SPI_SETLOWPOWERACTIVE,1,NULL,0); 
                      
                       fg_modeset(0,0,0,0);///get rid of VGA settings for other programs

                       return (msg.wParam);  // Returns the value from PostQuitMessage


                     }

                     ///this code is being compiled under Borland C++ v5 but the function calls are standard Windows API so
                     they should work under anything that supports them.

                     Submitted By: Sol (1998/11/19) 
                     Go up a level 