Delphi访问网上邻居的方法
procedure TForm1.ConnectServer; var NetSource : TNetResource; dwResult:DWORD; begin g_bFlag:=True; with NetSource do begin dwType := RESOURCETYPE_ANY; lpLocalName :=''; lpRemoteName:='\\172.16.3.209\all'; lpProvider :=''; end; dwResult:=WnetAddConnection2(NetSource,'123456','administrator',CONNECT_UPDATE_PROFILE); if dwResult<>0 then begin ShowMessage('连接服务器失败!'); g_bFlag:=False; end else begin //从服务里拷贝文件到本地D盘 // if copyfile(PChar('\\172.16.3.209\all\数据采集系统.zip'),PChar('d:/1.zip'),false) then // application.MessageBox('文件复制成功.','提示信息',64) // else // application.MessageBox('文件复制失败.','提示信息',48); Memo1.Lines := Searchfile('\\172.16.3.209\all'); // ShellExecute(0, 'open', pchar('\\172.16.3.209\all'), '', '', SW_SHOW); end; end; ———————————————— 原文链接:https://blog.csdn.net/wjw806/article/details/120361655
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.033326148986816 seconds