zoukankan      html  css  js  c++  java
  • 用命令行参数, 启动时最小化

     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;

  • 相关阅读:
    微信小程序学习心得
    微信小程序分类的实现
    Vue实例中封装api接口的思路 在页面中用async,await调用方法请求
    Vue中封装axios组件实例
    使用creata-react-app脚手架创建react项目时非常慢的问题
    Javascript的对象
    vue中上拉加载数据的实现
    Vue中键盘事件
    vant学习网址
    字符串,字典,数组写入本地文件和从本地文件读取
  • 原文地址:https://www.cnblogs.com/tulater/p/1323205.html
Copyright © 2011-2022 走看看