当前位置: 代码迷 >> PB >> yyoinge请进,PB 显示icon文件,文件、文件夹默认图标有关问题
  详细解决方案

yyoinge请进,PB 显示icon文件,文件、文件夹默认图标有关问题

热度:47   发布时间:2016-04-29 08:21:00.0
yyoinge请进,PB 显示icon文件,文件、文件夹默认图标问题
http://download.csdn.net/detail/yyoinge/3620196#comment
我下载了例子并且pb9可以显示,修改了api函数声明后在pb12.1也可显示了
我的问题是
我想做一个附件上传查询删除的功能,如何做到文件上传到数据库中保存后,在查询时可以显示出图标来?
数据库表中如何保存这个图标的信息?保存图标文件?保存图标句柄?都如何取得?

在查询时可以显示大约如下
图标 文件名 上传日期 上传人

------解决方案--------------------
图标的话 就是图像文件了 用blob存
create table s_info{
icon_file blob,
file_name varchar(30) primary key ,
update_date date,
user_name varchar(20)
}
然后 通过 
li_rtn = GetFileOpenName("Select File", &
docpath, docname[], "ico", &
+ "icon Files (*.ico),*.ico," &
+ "ico Files (*.ico),*.ico," &
+ "All Files (*.*), *.*")
if Not FileExists(docpath) then 
Messagebox('','File not Exists!')
return 
end if 
ll_len = fileLength(docpath)
if ll_len <1 then
FileCLose(li_file)
return
end if 
li_file = FileOpen(docpath,TextMode!,read!)
FileReadEx(li_file,lb_file)
再数据里面查询有没有该 文件
 select count(*) into:li_count 
 from s_info where file_name=:docpath;
if li_count=0 then 
insert into s_info(file_name,update_date,user_name)
values(docpath,today(),gs_username)
 if sqlca.sqlcode= 0 then
update s_info set icon_file=:lb_file where file_name=:docpath;
 end if
就保存到数据库里面了.
显示的话selectblob就可以了

------解决方案--------------------
不用把图标上传到服务器,在客户端根据扩展名,直接取系统默认的图标就可以
------解决方案--------------------
简单一点就是把常用的扩展名自己分别做成图片,显示dw调用显示就OK了
  相关解决方案