zoukankan      html  css  js  c++  java
  • 任务栏显示进度条 CreateComObject(CLSID_TaskbarList) as ITaskbarList4

     http://www.cnblogs.com/jxsoft/archive/2011/06/02/2067712.html

    //在任务栏显示 进度条

    unit Unit9;
    interface
    uses
      System.Classes, System.SysUtils, Vcl.Controls, Vcl.Forms, Vcl.StdCtrls,
      Vcl.ExtCtrls, ShlObj;
      //ShellAPI,  ObjectArray, PropSys, ExtCtrls, ImgList, DwmApi;
    type
      TForm9 = class(TForm)
        btnProgressbar: TButton;
        tmr1: TTimer;
        edtValue: TEdit;
        btnSetValue: TButton;
        procedure FormCreate(Sender: TObject);
        procedure btnProgressbarClick(Sender: TObject);
        procedure tmr1Timer(Sender: TObject);
        procedure btnSetValueClick(Sender: TObject);
      private
        { Private declarations }
        TBL: ITaskbarList4;
        I: Integer;
      public
        { Public declarations }
      end;
    var
      Form9: TForm9;
    implementation
    uses  ComObj;
    //uses ActiveX, ComObj, Math;
    {$R *.dfm}
    procedure TForm9.btnSetValueClick(Sender: TObject);
    begin
      TBL.SetProgressValue(Handle, StrToIntDef(edtValue.Text, 50), 100); //设置值 和最大值
    end;
    procedure TForm9.btnProgressbarClick(Sender: TObject);
    begin
      tmr1.Enabled := not tmr1.Enabled;//定时器 
    end;
    procedure TForm9.FormCreate(Sender: TObject);
    begin
      I := 0;
      TBL := CreateComObject(CLSID_TaskbarList) as ITaskbarList4; //创建对象
      TBL.SetProgressState(Handle, TBPF_NOPROGRESS or TBPF_INDETERMINATE); //初始化
      // or TBPF_INDETERMINATE
    end;
    procedure TForm9.tmr1Timer(Sender: TObject);
    begin
      if I < 100 then
        Inc(I);
      TBL.SetProgressValue(Handle, I, 100);
      if I >= 100 then
      begin
        TBL.SetProgressState(Handle, TBPF_NOPROGRESS);
        tmr1.Enabled := False;
        I := 0;
      end;
    end;
    end.
    object Form9: TForm9
      Left = 0
      Top = 0
      Caption = #20219#21153#26639#26174#31034#36827#24230#26465
      ClientHeight = 166
      ClientWidth = 335
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object btnProgressbar: TButton
        Left = 40
        Top = 24
        Width = 193
        Height = 33
        Caption = #33258#21160#36827#24230#26465
        TabOrder = 0
        OnClick = btnProgressbarClick
      end
      object edtValue: TEdit
        Left = 40
        Top = 89
        Width = 75
        Height = 21
        ImeName = #20013#25991' ('#31616#20307') - '#25628#29399#25340#38899#36755#20837#27861
        TabOrder = 1
      end
      object btnSetValue: TButton
        Left = 121
        Top = 87
        Width = 112
        Height = 25
        Caption = #25163#21160#35774#23450#36827#24230#20540
        TabOrder = 2
        OnClick = btnSetValueClick
      end
      object tmr1: TTimer
        Enabled = False
        Interval = 40
        OnTimer = tmr1Timer
        Left = 232
        Top = 96
      end
    end
    View Code
  • 相关阅读:
    树——题解汇总
    element ui实现手动上传文件,且只能上传单个文件,并能覆盖上传
    浏览器缓存
    websocket协议
    session
    cookie
    作用域插槽
    时间格式化函数
    Neo4j快速入门
    线性空间
  • 原文地址:https://www.cnblogs.com/rogge7/p/5980404.html
Copyright © 2011-2022 走看看