使用PB调用API自动更新(非FTP模式)(三、连接函数F_CONNECT_COPYSERVER)

发表于:2007-05-25来源:作者:点击数: 标签:api自动更新ftp模式
三、连接函数F_CONNECT_COPYSERVER 返回路径 global type f_connect_copyserver from function_object end type forward prototypes global function string f_connect_copyserver () end prototypes global function string f_connect_copyserver (); STRIN

三、连接函数F_CONNECT_COPYSERVER
返回路径
global type f_connect_copyserver from function_object
end type

forward prototypes
global function string f_connect_copyserver ()
end prototypes

global function string f_connect_copyserver ();
STRING GS_COPYSERVER1
STRING GS_COPYSERVER2
STRING GS_COPYSERVER3
STRING GS_COPYLOGINUSER1
STRING GS_COPYLOGINUSER2
STRING GS_COPYLOGINUSER3
STRING GS_COPYLOGINPASS1
STRING GS_COPYLOGINPASS2
STRING GS_COPYLOGINPASS3

GS_COPYSERVER1    = ProfileString("autodown.ini","downpath","COPYSERVER1","")
GS_COPYSERVER2    = ProfileString("autodown.ini","downpath","COPYSERVER2","")
GS_COPYSERVER3    = ProfileString("autodown.ini","downpath","COPYSERVER3","")
GS_COPYLOGINUSER1 = ProfileString("autodown.ini","downpath","COPYLOGINUSER1","")
GS_COPYLOGINUSER2 = ProfileString("autodown.ini","downpath","COPYLOGINUSER2","")
GS_COPYLOGINUSER3 = ProfileString("autodown.ini","downpath","COPYLOGINUSER3","")
GS_COPYLOGINPASS1 = ProfileString("autodown.ini","downpath","COPYLOGINPASS1","")
GS_COPYLOGINPASS2 = ProfileString("autodown.ini","downpath","COPYLOGINPASS2","")
GS_COPYLOGINPASS3 = ProfileString("autodown.ini","downpath","COPYLOGINPASS3","")

s_netresource ss_net

ss_net.dwScope = 0
ss_net.dwType  = 0//
ss_net.dwDisplayType = 0
ss_net.dwUsage = 0
ss_net.lpLocalName  = ''//
ss_net.lpRemoteName = GS_COPYSERVER1//
ss_net.lpComment    = ''
ss_net.lpProvider   = ''//

long ll_ret
string ls_path
ls_path = ''
ll_ret = WNetGetConnectionA('',GS_COPYSERVER1,255)
if ll_ret <> 0 then
 ll_ret = WNetGetConnectionA('',GS_COPYSERVER2,255)
 if ll_ret <> 0 then
  ll_ret = WNetGetConnectionA('',GS_COPYSERVER3,255)
  if ll_ret = 0 then
   return GS_COPYSERVER3
  end if
 else
  return GS_COPYSERVER2
 end if
else
 return GS_COPYSERVER1
end if
//gl_handle,
ll_ret = WNetAddConnection2A(ss_net,GS_COPYLOGINPASS1,GS_COPYLOGINUSER1,1)
if ll_ret <> 0 then
 ss_net.dwScope = 0
 ss_net.dwType  = 0//
 ss_net.dwDisplayType = 0
 ss_net.dwUsage = 0
 ss_net.lpLocalName  = ''//
 ss_net.lpRemoteName = GS_COPYSERVER2//
 ss_net.lpComment    = ''
 ss_net.lpProvider   = ''//
 ll_ret = WNetAddConnection2A(ss_net,GS_COPYLOGINPASS2,GS_COPYLOGINUSER2,1)
 if ll_ret <> 0 then
  ss_net.dwScope = 0
  ss_net.dwType  = 0//
  ss_net.dwDisplayType = 0
  ss_net.dwUsage = 0
  ss_net.lpLocalName  = ''//
  ss_net.lpRemoteName = GS_COPYSERVER3//
  ss_net.lpComment    = ''
  ss_net.lpProvider   = ''//
  ll_ret = WNetAddConnection2A(ss_net,GS_COPYLOGINPASS3,GS_COPYLOGINUSER3,1)
  if ll_ret <> 0 then
   //messagebox('错误!','连接服务器错误!',stopsign!)
   return ls_path
  end if
  ls_path = GS_COPYSERVER3
 else
  ls_path = GS_COPYSERVER2
 end if
else
 ls_path = GS_COPYSERVER1
end if
if isnull(ls_path) then ls_path = ''
//messagebox('',ls_path)
return ls_path

end function

 

原文转自:http://www.ltesting.net