首先将 Form 的formStyle 属性设置为 fsStayOnTop
然后在 form 的 OnCreate 中重载 Application.OnMessage
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure MyProc (var Msg: TMsg; var Handled: Boolean);
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage:=MyProc;
end;
procedure TForm1.MyProc(var Msg: TMsg; var Handled: Boolean);
begin
if (msg.wparam=SC_MINIMIZE) then handled:=true;
end;
end.