Solved

Terminate when screensaver activates

Posted on 2000-04-24
4
323 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
[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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 231
creating threads in delphi 1 203
MS Access from Delphi 31 106
SQL Server Express automatically execute SQL or SP 8 70
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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