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;

  • 相关阅读:
    vSphere笔记01~02
    【科普】人眼到底等于多少像素
    《标题党》自我修炼的10个秘籍
    说说云盘背后的黑科技!
    用shell批量编码转换
    Java课设--俄罗斯方块Tetris
    教程,Python图片转字符堆叠图
    谈谈索引的哲学思想
    MySQL索引实战经验总结
    博客要转型啦
  • 原文地址:https://www.cnblogs.com/tulater/p/1323205.html
Copyright © 2011-2022 走看看