Unit unit1;
Interface
Useswindows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls, Comctrls
type TForm1 = class (TForm) Panel1: TPanel; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; procedure Button1Click (Sender: TObject); procedure Button2Click (Sender: TObject); procedure Button3Click ( Sender: TOBJECT); Procedure Button4Click (sender: TOBJECT); Procedure Button5Click (Sender: TOBJECT); private {private declarations} end;
Var Form1: TFORM1;
IMPLEMentation
Uses Unit2, Unit3, Unit4, Unit5;
{$ R * .dfm}
Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); Beginform2.show; // setwindowpos (form2.handle, hwnd_topmost, self.left, self.top, self.width, self.Height, SWP_SHOWINDOW);
// This sentence is the key
SetWindowPos (Form2.Handle, HWND_NOTOPMOST, 100, 125, 600, 400, SWP_SHOWINDOW);
END;
Procedure TFORM1.BUTTON2CLICK (Sender: TOBJECT); Begin ShowMessage ('xxx');
Procedure TFORM1.BUTTON3CLICK (Sender: TOBJECT); Begin
Form3.Show; // setwindowpos (form2.handle, hwnd_topmost, self.left, self.top, self.width, self.height, swp_showwindow);
// This sentence is the key
SetWindowPos (form3.handle, hwnd_topmost, 100, 105, 600, 400, swp_showwindow);
END;
Procedure TFORM1.BUTTON4CLICK (Sender: TOBJECT); Begin
Form4.show; // setwindowpos (form2.handle, hwnd_topmost, self.left, self.top, self.width, self.height, swp_showwindow);
// This sentence is the key
SetWindowPos (Form4.Handle, Hwnd_topmost, 100, 125, 600, 400, SWP_SHOWWINDOW);
END;
Procedure TFORM1.BUTTON5CLICK (Sender: TOBJECT); Begin Form5.showModal ;; End;
End.
Unit unit2;
Interface
Uses
Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, stdctrls;
Type
TFORM2 = Class (TFORM)
Button1: tbutton;
Procedure Formresize (Sender: TOBJECT);
Procedure Button1Click (Sender: TOBJECT);
Private
{Private Declarations}
Procedure WMGETMAXINFO (VAR Message: TwmgetminMaxInfo);
Message WM_GETMINMAXINFO;
public
{Public declarations}
END;
VAR
Form2: TFORM2;
IMPLEMENTATION
{$ R * .dfm}
// Do not jump up when using this statement
Procedure TFORM2.WMGETMINMAXINFO (VAR Message: TwMgetminMaxInfo);
Begin
With message.minmaxinfo ^ DO
Begin
PTMAXSIZE.X: = 900; {Maximum Width}
PTMAXSIZE.Y: = 400; {Maximum Time}
PtmaxPosition.x: = 1; {Maximize the left upper horizontal coordinate}
PTMaxPosition.y: = 125; {Maximize the left upper left corner longitudinal coordinate}
END;
Message.Result: = 0; {Tell Windows you have changed minMaxinfo}
inherited;
END;
Procedure TFORM2.FORMRESIZE (Sender: TOBJECT);
Begin
// form2.top:=125;
END;
Procedure TFORM2.BUTTON1CLICK (Sender: TOBJECT);
Begin
ShowMessage ('zzz');
END;
End.