Solved

Terminate when screensaver activates

Posted on 2000-04-24
4
297 Views
Last Modified: 2010-04-04
Hi, Thanks for your site..
I'm using Delphi 3
I need my application to Terminate
when the Windows Screensaver is
Activated.
Please help me...I'm stuck with this.
Thanks again
Fernandez
0
Comment
Question by:fernandez
4 Comments
 
LVL 1

Expert Comment

by:DValery
ID: 2743422
You can use API function:

SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0)


0
 
LVL 2

Expert Comment

by:Serega
ID: 2743426
You can send any mouse message (WM_MBUTTONDOWN) to screensaver window. It handle you can find by using WindowFromPoint() function at any point of the screen.
0
 
LVL 2

Accepted Solution

by:
craig_capel earned 75 total points
ID: 2743465
unit Unit1;

 interface

 uses
   Windows, Messages, SysUtils, Classes,
   Graphics, Controls, Forms, Dialogs;

 type
   TForm1 = class(TForm)
   private
     procedure WMSysCommand(var Msg : TWMSysCommand);
               message WM_SYSCOMMAND;
   public
     { Public declarations }
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.DFM}

 procedure TForm1.WMSysCommand(var Msg : TWMSysCommand);
 begin
   //trap the message and set its result to -1
   if (Msg.CmdType = SC_SCREENSAVE) then
 begin
    // Msg.Result := -1
    Close; //Close Down Program!
end
   else
     inherited;
 end;

 end.

This will close your delphi program down when the screen saver activates... exactly how you asked.... :)

Craig C.
0
 

Author Comment

by:fernandez
ID: 2744042
Thanks a lot
Your just saved my day
steven :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

12 Experts available now in Live!

Get 1:1 Help Now