Solved

How to disable screen saver?

Posted on 1998-12-09
5
382 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

743 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

11 Experts available now in Live!

Get 1:1 Help Now