Solved

How to disable screen saver?

Posted on 1998-12-09
5
395 Views
Last Modified: 2010-04-02
How to disable screen saver from running while my program is running?
In win98 and winnt 4.
0
Comment
Question by:stl
5 Comments
 
LVL 1

Expert Comment

by:sunj
ID: 1179794
try this:
      SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,FALSE,0,0);

sunj
0
 

Author Comment

by:stl
ID: 1179795
Does not work in win98...
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1179796
You have to set the registry value in:
HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveActive = 0  
or perhaps ScreenSaveTimeOut = 4,294,967,295
use the RegOpenKey and RegSetValue functions to set the values..
 

0
 

Author Comment

by:stl
ID: 1179797
The registry settings is changed.
But windows need to be restarted to take effect for the new setting!
0
 
LVL 1

Accepted Solution

by:
prozak earned 50 total points
ID: 1179798
Try adding this code to your window function:

switch (message)
{
  // add this code
  case WM_SYSCOMMAND :
    if(wParam == SC_SCREENSAVE)
      return 0;
    break;
  // end add code
}

This will eat all of the screen saver messages generated by windows and the screen saver will not start. This should work on all versions of windows.

Hope this helps...
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

813 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

17 Experts available now in Live!

Get 1:1 Help Now