• 用命令行参数, 启动时最小化


     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;

  • 相关阅读:
    SpringSecurity 框架学习 3
    SpringSecurity 框架学习 项目创建
    nginx 限制ip访问
    nginx 负载均衡,后端服务获取不到域名问题
    Linux 安装 Nginx
    Linux 常用命令
    springcloud 服务追踪
    Hystrix 服务容错
    Scrum立会报告+燃尽图(十二月十日总第四十一次):用户推广
    Final发布:文案+美工展示博客
  • 原文地址:https://www.cnblogs.com/tulater/p/1323205.html
Copyright © 2020-2023  润新知