unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, SxTrayIcon;
type
TForm1 = class(TForm)
SxTrayIcon1: TSxTrayIcon;
procedure FormCreate(Sender: TObject);
procedure toTray(Sender: TObject);
procedure fromTray(Sender: TObject);
procedure SxTrayIcon1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.toTray(Sender: TObject);
var Owner: HWND;
begin
Owner:=GetWindow(
Handle,GW_OWNER);
ShowWindow(Owner,SW_HIDE);
end;
procedure TForm1.fromTray(Sender: TObject);
var Owner: HWND;
begin
Owner:=GetWindow(
Handle,GW_OWNER);
ShowWindow(Owner,SW_SHOW);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SxTrayIcon1.Active := true;
Application.OnMinimize := toTray;
end;
procedure TForm1.SxTrayIcon1DblClick(Sender: TObject);
begin
fromTray(self);
Application.Restore;
end;
end.