Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Terminate when screensaver activates

Posted on 2000-04-24
4
Medium Priority
?
336 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 300 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

660 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