| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;
type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private procedure DoRestore(Sender: TObject); procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure SetToolApp; begin ShowWindow(Application.Handle, SW_HIDE); SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW); end;
procedure ResetToolApp; begin SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) and not WS_EX_TOOLWINDOW or WS_EX_APPWINDOW); end;
procedure TForm1.FormCreate(Sender: TObject); begin SetToolApp; Application.OnRestore := DoRestore; end;
procedure TForm1.WMSysCommand(var Message: TWMSysCommand); begin if Message.CmdType = SC_MINIMIZE then ResetToolApp; inherited; end;
procedure TForm1.DoRestore(Sender: TObject); begin SetToolApp; end;
end.
| |