Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to check when a screen saver has been invoked Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
04-Oct-02
Category
VCL-General
Language
Delphi 2.x
Views
41
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius 

I want my application to go into 'sleep mode' when the screen saver has been 
started.

Answer:

1   unit U1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
7   StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      Label1: TLabel;
12      procedure FormCreate(Sender: TObject);
13    private
14      { Private declarations }
15      procedure AppMessage(var AMessage: TMsg; var Handled: Boolean);
16    public
17      { Public declarations }
18    end;
19  
20  var
21    Form1: TForm1;
22  
23  implementation
24  
25  {$R *.DFM}
26  
27  {Get screen saver messages}
28  
29  procedure TForm1.AppMessage(var AMessage: TMsg; var Handled: Boolean);
30  begin
31    if ((WM_SYSCOMMAND = AMessage.message) and (SC_SCREENSAVE = AMessage.wParam)) then
32    begin
33      Handled := True;
34      Label1.Caption := 'Warning! Screen saver detected. Top clearance required.';
35      Handled := False;
36    end;
37  end;
38  
39  {On form create}
40  
41  procedure TForm1.FormCreate(Sender: TObject);
42  begin
43    Application.OnMessage := AppMessage;
44  end;
45  
46  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC