Program Project1;Uses
Forms,
Windows,
Messages,
SysUtils;
{$R *.res}
Begin
{=================-start 隱藏主窗體=================}
If LowerCase(ParamStr(1)) = '-start' Then Begin
ShowWindow(Application.Handle, SW_HIDE);
Application.ShowMainForm := False;
End;
{===================================================}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
End.
aaaa
TForm1 = Class(TForm)
Protected
Procedure wndproc(Var message: Tmessage); Override;
End;
Procedure TForm1.wndproc(Var message: Tmessage);
Begin
Case message.msg Of
WM_SYSCOMMAND: Begin
Try
Case message.WParam Of
SC_CLOSE , SC_MINIMIZE: Begin
CoolTrayIcon1.MinimizeToTray := True;
Application.Minimize;
End;
Else
Inherited wndproc(message);
End;
Except
On EAccessViolation Do ;
End;
End;
End;
End;
Procedure TForm1.FormCreate(Sender: TObject);
Var
dwStyle: DWord ;
Begin
{==========設置當前窗體屬性,不在任務欄出現=================}
dwStyle := GetWindowLong(Form1.Handle,GWL_EXSTYLE);
dwStyle :=dwStyle or WS_EX_TOOLWINDOW;
SetWindowLong(Application.Handle,GWL_EXSTYLE,dwStyle);
{=======================================================}
End;