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 intercept a click on the forms' minimize button 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
10-Oct-02
Category
VCL-Forms
Language
Delphi 2.x
Views
130
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Does anybody know how to capture the minimize button press and act on it before it 
actually minimizes the form?

Answer:

You should intercept WM_SYSCOMMAND messages like this:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, 
7   Dialogs;
8   
9   type
10    TForm1 = class(TForm)
11    public
12      procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
13    end;
14  
15  var
16    Form1: TForm1;
17  
18  implementation
19  
20  {$R *.DFM}
21  
22  procedure TForm1.WMSysCommand;
23  begin
24    if (Msg.CmdType = SC_MINIMIZE) or (Msg.CmdType = SC_MAXIMIZE) then
25      MessageBeep(0);
26    DefaultHandler(Msg);
27  end;
28  
29  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