所用到的有关文件传送的函数如下:
Function Long SetCurrentDirectoryA(String as_path) Library "kernel32.dll"
FUNCTION ulong GetCurrentDirectoryA(ulong BufferLen, ref string currentdir) LIBRARY "kernel32.dll"
Function boolean GetFileDateTime(string lpFileName,uint nMode,ref string lpDate,ref string lpTime) Library "mHand.dll"
Function boolean MoveFileA(ref string lpExistingFileName,ref string lpNewFileName) LIBRARY "kernel32.dll"
FUNCTION long CreateDirectoryA(ref string pathname, int sa) LIBRARY "Kernel32.dll"
Function long MyFTP_GetListFileInfo(long FileNo,long InfoNo,ref string content) library 'MyFtp.dll'
Function long MyFTP_ChangeDirectoryUp() library 'MyFtp.dll'
Function long MyFTP_ChangeDirectory(ref string dirname) library 'MyFtp.dll'
function long MyFTP_ConnectServer(ref string Host,long port,ref string usrid,ref string pass) library 'MyFTP.dll'
function long MyFTP_Disconnect() library 'MyFTP.dll'
Function long MyFTP_DownloadFile(ref string srcFile,ref String DstFile) library 'MyFTP.dll'
Function long MyFTP_GetCurrentDirectory(ref string ls_dir) library 'MyFTP.dll'
ls_download_name=gs_download_name+' '
li_start=1
for li_i=1 to gi_down
li_len=pos(ls_download_name,' ',li_start)
ls_extract_name=mid(ls_download_name,li_start,li_len - li_start)
ls_extract_s=ls_extract_s+'arj x '+ls_extract_name+' -y~r~n'
li_start=li_len+1
next
li_filenum = fileopen("check.bat",StreamMode!,Write!,LockWrite!,Replace!)
// filewrite(li_filenum,"del *.arj~r~nftp -s:om_ftp.cfg~r~narj x *.arj -y~r~ndel *.arj~r~n")
filewrite(li_filenum,"del *.arj~r~nftp -s:check.cfg~r~n"+ls_extract_s+"del *.arj~r~n")
fileclose(li_filenum)
li_rpt = run("check.bat",Normal!)
end if
其次,登陆时判断
li_down = wf_get_version(9998)
if li_down>0 then
gi_down=li_down
li_ret=messagebox(‘提示','是否更新?'¸,question!,yesno!,1)
if li_ret=1 then
gb_down_new=true
disconnect;
halt close
end if
end if
附上窗口函数:
int li_down
string ls_new_version,ls_use_version,ls_count_name
boolean lb_update
if gl_staff_id =0 then
lb_update=true
end if
ls_use_version=f_ver_rm_check()
select current_value into :ls_new_version from sys_config where config_id=:count;
if sqlca.sqlcode<>0 then
messagebox("提示","请维护sys_config表中config_id=9998的信息")
return 0
end if
ls_new_version=trim(upper(ls_new_version))
ls_use_version=trim(upper(ls_use_version))
if ls_use_version>ls_new_version and lb_update then
update SYS_CONFIG set CURRENT_VALUE = :ls_use_version
where CONFIG_ID = :count;
commit;
elseif ls_use_version<ls_new_version then
li_down=1
end if
return(li_down)