Program Project1;
Uses
Forms,
Windows,
Messages,
SysUtils;
{$R *.res}
Begin
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.
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;
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;
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;
Var
dwStyle: DWORD ;
Begin
{==========设置当前窗体属性,不在任务栏出现=================}
dwStyle := GetWindowLong(Form1.Handle,GWL_EXSTYLE);
dwStyle :=dwStyle or WS_EX_TOOLWINDOW;
SetWindowLong(Application.Handle,GWL_EXSTYLE,dwStyle);
{=======================================================}
End;