filedownloader.pas
来自「Yahoo Messenger for Mobile」· PAS 代码 · 共 119 行
PAS
119 行
unit filedownloader;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DynamicSkinForm, stdCtrls, Mask, SkinBoxCtrls, SkinCtrls, ExtCtrls;
type
TForm39 = class(TForm)
spSkinStdLabel1: TspSkinStdLabel;
spSkinStdLabel2: TspSkinStdLabel;
spSkinStdLabel3: TspSkinStdLabel;
spSkinGauge1: TspSkinGauge;
spSkinEdit1: TspSkinEdit;
spSkinEdit2: TspSkinEdit;
spSkinEdit3: TspSkinEdit;
spSkinButton1: TspSkinButton;
spSkinButton2: TspSkinButton;
Checkbox1: TspSkinCheckRadioBox;
Timer1: TTimer;
spSkinButton3: TspSkinButton;
procedure spSkinButton1Click(Sender: TObject);
procedure spSkinButton2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Checkbox1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure spSkinButton3Click(Sender: TObject);
private
procedure CreateParams(var Params : TCreateParams); override;
{ Private declarations }
public
ThreadObj: Pointer;
FileName: String;
Cancel: Boolean;
Seconds: Integer;
Total: Integer;
Url: String;
{ Public declarations }
end;
var
Form39: TForm39;
implementation
uses YchatU1;
{$R *.DFM}
procedure TForm39.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle:= Params.ExStyle or WS_EX_APPWINDOW ; //WS_EX_APPWINDOW;
end;
procedure TForm39.spSkinButton1Click(Sender: TObject);
begin
Form1.ShellEXecute(0,'open',Pchar(Self.FileName),'','',Sw_Show);
end;
procedure TForm39.spSkinButton2Click(Sender: TObject);
begin
{ Cancel:=True;
TFileDownload(ThreadObj).Terminate;
WaitForSingleObject(Longint(ThreadObj),20000);
SendMessage(Form1.Handle,Wm_User+112,Integer(Self),99);}
Close;
end;
procedure TForm39.FormCreate(Sender: TObject);
begin
Cancel:=False;
Seconds:=0;
Total:=0;
end;
procedure TForm39.Checkbox1Click(Sender: TObject);
begin
If CheckBox1.Checked=True Then
Self.FormStyle:=FsStayOnTop
Else
Self.FormStyle:=FsNormal;
end;
procedure TForm39.Timer1Timer(Sender: TObject);
begin
Inc(Seconds);
Total:=Total+TFileDownload(ThreadObj).Cks;
TFileDownload(ThreadObj).AKpF:=(Total/seconds)/1024;
TFileDownload(ThreadObj).KpF:=TFileDownload(ThreadObj).Cks/1024;
TFileDownload(ThreadObj).Cks:=0;
end;
procedure TForm39.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Cancel:=True;
TFileDownload(ThreadObj).Terminate;
WaitForSingleObject(Longint(ThreadObj),20000);
SendMessage(Form1.Handle,Wm_User+112,Integer(Self),99);
end;
procedure TForm39.spSkinButton3Click(Sender: TObject);
begin
If TButton(Sender).Caption='Pause' Then
Begin
TFileDownload(ThreadObj).Pause;
TButton(Sender).Caption:='Resume'
End
else
Begin
TButton(Sender).Caption:='Pause';
TFileDownload(ThreadObj).Go;
End;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?