Comments (4)
没研究过,不过windows下可以通过注册表获取扩展名的图标,这种百度找找应该有的
from govcl.
能帮忙看一下最后那几行关于 win.SHGetFileInfo和win.TSHFileInfo 哪里有问题吗 谢谢 研究一天了没有搞定
func (f *TForm1) walkFile(node *vcl.TTreeNode, path string, recurse bool) {
fd, err := os.Open(path)
if err != nil {
if os.IsNotExist(err) {
return
}
return
}
defer fd.Close()
// 添加当前目录
if recurse && (node == nil) {
subNode := f.TreeView1.Items().Add(nil, ".")
f.paths[subNode.Instance()] = path
subNode.SetSelectedIndex(1)
subNode.SetStateIndex(0)
}
//imgList := vcl.NewImageList(f)
ico := vcl.NewIcon()
ico.SetTransparent(true)
ImageList1 := vcl.NewImageList(f)
ImageList1.SetHeight(16)
ImageList1.SetWidth(16)
f.ListView1.SetSmallImages(ImageList1)
defer ico.Free()
for {
files, err := fd.Readdir(100)
for _, file := range files {
if recurse {
if file.IsDir() {
curPath := path + string(os.PathSeparator) + file.Name()
var subNode *vcl.TTreeNode
if node == nil {
subNode = f.TreeView1.Items().Add(nil, file.Name())
} else {
subNode = f.TreeView1.Items().AddChild(node, file.Name())
}
//subNode.SetImageIndex(0)
subNode.SetSelectedIndex(1)
subNode.SetStateIndex(0)
//subNode.SetData(unsafe.Pointer(uintptr(index)))
f.paths[subNode.Instance()] = curPath
f.walkFile(subNode, curPath, recurse)
subNode.Expand(false)
}
} else {
var shfi win.TSHFileInfo
win.SHGetFileInfo(path+ string(os.PathSeparator) + file.Name(),0,&shfi,win.SHGFI_SYSICONINDEX|win.SHGFI_SMALLICON|win.SHGFI_PIDL)
ico.SetHandle(shfi.HIcon)
index := ImageList1.AddIcon(ico)
item := f.ListView1.Items().Add()
item.SetImageIndex(index)
item.SetCaption(file.Name())
item.SubItems().Add(fmt.Sprintf("%d byte", file.Size()))
item.SubItems().Add(filepath.Ext(file.Name()))
}
}
if err == io.EOF {
break
}
if len(files) == 0 {
break
}
}
}
from govcl.
@ying32
shell32dll.go
这个文件的 79行是不是少一个参数?
r, _, _ := _SHGetFileInfo.Call(CStr(pszPath), uintptr(dwFileAttributes), uintptr(unsafe.Pointer(psfi)), uintptr(uFlags))
应该为
r, _, _ := _SHGetFileInfo.Call(CStr(pszPath), uintptr(dwFileAttributes), uintptr(unsafe.Pointer(psfi)),uintptr(unsafe.Sizeof(*psfi)), uintptr(uFlags))
from govcl.
确实是少个 cbFileInfo
from govcl.
Related Issues (20)
- 关于开发调试 HOT 5
- Lazarus安装res2go组件报错问题 HOT 1
- MacOS13.3错误 HOT 7
- 使用garble代码混淆工具混淆后, 事件无法被调用 HOT 1
- 这个怎么感觉跟delphi的那个挺像的,能在delphi直接开发吗 HOT 1
- TListView滚动至底部 HOT 1
- 想实现一个检索窗口,如图。输入框输入内容,在输入框下方显示一个窗口用来显示检索结果,点击可以选中相应内容,这个是用到哪个组件 HOT 2
- Setting color colors.ClGray to canvas pen or brush of a form struct which has colorbox and toolbar field, crashes the program. HOT 2
- 请问这个背景颜色可以设置吗 HOT 2
- 运行 imageviewer demo报错 HOT 1
- TMemo & TRichEdit component can't find "SetMargin" function HOT 1
- linux 平台下,启动程序前出现莫名窗口 HOT 2
- 去掉黑框问题 HOT 4
- TPageControl has no TabVisible property available HOT 2
- 请问GoVCLDesigner😍是开源的吗? HOT 2
- initFile 中readDate、readTime、readDateTime三个返回的是0,导致解析成1970-01-01.... HOT 2
- res2go doesn't work. HOT 8
- 这几个组件是不支持吗? HOT 2
- res2go插件包名无法删除 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from govcl.