大于32K图片的存取例程!
函数gf_open_pic:<BR>//////////////////////////////////////////////////////////////////<BR>//Add by Jeffrey Jiang on 2001.11.13<BR>//选择图片<BR>/////////////////////////////////////////////////////////////////<BR>//Modfiy by Jeffrey Jiang on 2001.11.15<BR>//当图片字节大于32765时,循环读图片<BR>///////////////////////////////////////////////////////////////// <BR><BR><BR><BR><BR><BR>integer li_file,li_ret,loops,i<BR>string ls_file,ls_path<BR>blob lb_small<BR>long flen,bytes_read,new_pos<BR><BR><BR>//search the file<BR>li_ret = getfileopenname("选择图片文件",ls_path,ls_file, &"BMP","图片文件(*.BMP),*.BMP")<BR>if li_ret = 1 then<BR>p_1.picturename = ''<BR>p_1.picturename = ''<BR>setnull(lb_image)<BR>if li_file <> -1 then<BR>// Set a wait cursor<BR>setpointer(hourglass!)<BR><BR><BR>flen = filelength(ls_file)<BR>li_file = fileopen(ls_path,streammode!,read!,lockread!)<BR>// Determine how many times to call FileRead<BR>if flen > 32765 then<BR>if mod(flen,32765)=0 then<BR>loops = flen/32765<BR>else<BR>loops = (flen/32765) + 1<BR>end if<BR>else<BR>loops = 1<BR>end if<BR>// Read the file<BR>new_pos = 1<BR>for i = 1 to loops<BR>bytes_read = fileread(li_file,lb_small)<BR>if i = 1 then<BR>lb_image = lb_small<BR>else<BR>lb_image = lb_image + lb_small<BR>end if<BR>next<BR>// close the file<BR>fileclose(li_file)<BR>end if<BR>end if<BR>return lb_image
页:
[1]