关于事件或函数递归调用自身出错的问题
本人写了个用户事件 ue_read_updatelog()和函数 of_read_updatelog(),两者内容相同
代码为
string ls_filename,ls_log_name,ls_log_recode,ls_current_directory,ls_new_directory
ulong ll_hfilehandle
long ll_find_next,ll_close,ll_move
int i
win32_find_data lstr_find_data,lstr_dummy
i=1
is_file_time1 = ''
is_file_time2 = ''
is_log_name = ''
ls_log_name = ''
lstr_find_data = lstr_dummy
ls_filename = 'update_log\*.txt'
//find the first file and return the handle of the file
ll_hfilehandle = FindFirstFileA(ls_filename,lstr_find_data)
//get the file's name and check it
is_log_name = of_get_filename(ll_hfilehandle,lstr_find_data)
//Don't find file or the file don't fit
if is_log_name = '' then
ll_close = FindClose(ll_hfilehandle)
return
end if
ll_close = FindClose(ll_hfilehandle)
if is_log_name <> '' and mid(is_log_name,4,2) = is_db_id then
of_update_log(is_log_name)
ls_current_directory = 'update_log\' + is_log_name
ls_new_directory = 'history\' + is_log_name
ll_move = filemove(ls_current_directory,ls_new_directory)
if ll_move <> 1 then
filecopy(ls_current_directory,ls_new_directory)
filedelete(ls_current_directory)
end if
end if
this.event ue_read_updatelog()或of_read_updatelog()
作用是寻找 \update_log\ 下的*.txt文件,看文件的命名是否符合要求(of_get_filename()函数用来判断),通过of_update_log()函数将符合的文件中的数据update到数据库中.
现在出现如下问题:
我是在窗口w_export的open事件中打开,w_export窗口的父窗口为w_main.
1.当update_log文件夹中的txt文件过多时(至少多于64个)时经常会报错
2.当文件比较少的时候如30个
可顺利运行打开w_export窗口,然后关闭w_export窗口,再打开,反复2次,仍会报错
AppName: pb90.exe AppVer: 9.0.0.5507 ModName: pbvm90.dll
ModVer: 9.0.1.7275 Offset: 001a82a1
错误报告
Exception Information
Code: 0xc0000005 Flags: 0x00000000
Record: 0x0000000000000000 Address: 0x0000000010ca82a1
个人想法:个人认为是过多的递归调用,使pbvm90.dll中某些资源大量占用,不能即时释放导至
请帮忙看看是什么问题,谢谢大家了!