如何访问局域网上的文件

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 wangzn1979 的 blog

var
  netsource : tnetresource;    file://连接服务器结构
  dwresult:dword;               file://连接文件服务器的返回值

procedure connectserver;
begin
    g_bflag:=true;
    netsource.dwtype:= resourcetype_any;
    netsource.lplocalname:='';
    netsource.lpremotename:=pansichar('\\'+g_sserverip);
    netsource.lpprovider:='';
    dwresult:=wnetaddconnection2(netsource,pansichar(g_sserverpassword),pansichar(g_sserverusername),connect_update_profile);
    if dwresult<>0 then
    begin
        messagedlg('连接文件服务器失败!'#13#10'请重新设置!',mtwarning,[mbok],0);
        g_bflag:=false;
    end;
end;

procedure disconnectserver;
begin
    if g_bflag then
        wnetcancelconnection2(pansichar('\\'+g_sserverip), connect_update_profile, true);
end;

本文关键:局域网
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top