Solved

Terminate when screensaver activates

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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