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 the maximize command 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
03-Sep-02
Category
Win API
Language
Delphi 2.x
Views
101
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas 

How to intercept the maximize command

Answer:

If you want to restrict your window's maximum size (or minimum size, for that 
matter), you may try to intercept WM_SYSCOMMAND and check for the value of wParam.

More elegant is to intercept WM_GETMINMAXINFO, as the following example shows: 


1   type
2     TMyForm = class(TForm)
3       procedure _WM_GETMINMAXINFO(var mmInfo: TWMGETMINMAXINFO); message
4         wm_GetMinMaxInfo;
5     end;
6   
7     //..
8   
9   procedure TMyForm._WM_GETMINMAXINFO(var mmInfo: TWMGETMINMAXINFO);
10  begin
11    with mmInfo.minmaxinfo^ do
12    begin
13      // allow at most half of the screen, and position it in the middle
14      ptmaxposition.x := Screen.Width div 4;
15      ptmaxposition.y := Screen.Height div 4;
16  
17      ptmaxsize.x := Screen.Width div 2;
18      ptmaxsize.y := Screen.Height div 2;
19    end;
20  end;
21  
22  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