Minimize the number of windows in delphi, and set the parameter based on the default value during the operation.

Source: Internet
Author: User
Determine whether the mouse window is pressed to minimize or not. When the mouse is pressed to minimize, the mouse can intercept the messages at the specified time. there are two ways to do this. from Delphi Republic -- Method 1: intercept the WM_SYSCOMMAND message to check whether the form is in the minimized state.
Type
TForm1 = class (TForm)
Private
Procedure WMSysCommand (var Message: TMessage); message WM_SYSCOMM
AND;
//...
End;
Implementation
{$ R *. DFM}
Procedure TForm1.WMSysCommand (var Message: TMessage );
Begin
If Message. WParam = SC _ICON then // minimizes. SC _ZOOM to the maximum extent.
Begin
// Form1.hide ;...
End
Else
Inherited; // very important. The last time it was because this sentence was not added, the window cannot be dragged.
End;

Method 2: Determine whether the minimal button of the non-customer partition of the form is clicked.
Type
TForm1 = class (TForm)
Private
Procedure Minimize (var mess: TWMNCLBUTTONDOWN); message WM_NCLBUTTON
DOWN;
//...
End;
Implementation
{$ R *. DFM}
Procedure TForm1.Minimize (var mess: TWMNCLBUTTONDOWN );
Begin
If mess. hittest = htreduce then // htreduce indicates whether the minimization button is pressed. Close: HTCLOSE
Begin
// Form1.hide ;...
End
Else
Inherited; // same importance
End;
In fact, I know when I pressed the window to minimize the number of threads and so on. The others are quite clear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.