Solved

How to disable screen saver?

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

728 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