[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Turning screen saver off in Delphi 1

How do you turn the screen saver off in Delphi 1 (for Windows 3.1 programming)? I want to turn it off when it is running. I've tried the WIN3.1 API SendMessage function, but I may be sending the wrong parameters. (Please test anything before you post it.) I have used the API function SystemParametersInfo to make sure a screensaver is available, and then the PostMessage (GetDeskTopWindow, WM_SYSCOMMAND, SC_SCREENSAVE, 0) to start the screensaver, but I can't get the screensaver to stop running.
0
elmarais
Asked:
elmarais
  • 2
  • 2
1 Solution
 
EpsylonCommented:
Use   SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, nil, 0);

0
 
elmaraisAuthor Commented:
Edited text of question.
0
 
MadshiCommented:
Well, I don't have D1 installed, so I can't test it. But this should work:

  PostMessage(FindWindow('WindowsScreenSaverClass',nil),WM_CLOSE,0,0);

Regards, Madshi.
0
 
elmaraisAuthor Commented:
Well, Madshi - it works! ! ! !

You saved me a l-o-t of time, thanks!

Now how do I get the 100 points back? :-)
0
 
MadshiCommented:
Well, that's great that it works. I only hoped that these APIs were available in 16bit Windows, too...   :-)

How you get your points back?    :-)
Either wait 20 days (you get 5 points each day) or buy 100 points...    :-)

Regards, Madshi.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now