?
Solved

How to disable screen saver?

Posted on 1998-12-09
5
Medium Priority
?
431 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
[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
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 100 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
Suggested Courses

650 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