SHGetFileInfo的用法
2010-11-18 11:38
381 查看
函数原型:
WINSHELLAPI DWORD WINAPI SHGetFileInfo
(
LPCTSTR
pszPath
,
DWORD
dwFileAttributes
,
SHFILEINFO FAR
*psfi
,
UINT
cbFileInfo
,
UINT
uFlags
);
其中,当uFlags使用
SHGFI_ICON时,注意下面一段:
Retrieve the handle to the icon that represents the file and the index of the
icon within the system image list. The handle is copied to the hIcon
member of the structure specified by psfi
, and the index is copied to the
iIcon
member. The return value is the handle to the system image list.
You must call the DestroyIcon
function on this icon handle.
否则会造成内存泄露,SHGetFileInfo再使用时就获取不到图标.
遇到不解的问题,首先查MSDN...
另外,如果使用这个函数获取其它信息,比如文件类型,那么参数里就不要再使用
SHGFI_ICON,因为这样如果不注意,后面没有DestroyIcon,同样会引起图标消失的问题
WINSHELLAPI DWORD WINAPI SHGetFileInfo
(
LPCTSTR
pszPath
,
DWORD
dwFileAttributes
,
SHFILEINFO FAR
*psfi
,
UINT
cbFileInfo
,
UINT
uFlags
);
其中,当uFlags使用
SHGFI_ICON时,注意下面一段:
Retrieve the handle to the icon that represents the file and the index of the
icon within the system image list. The handle is copied to the hIcon
member of the structure specified by psfi
, and the index is copied to the
iIcon
member. The return value is the handle to the system image list.
You must call the DestroyIcon
function on this icon handle.
否则会造成内存泄露,SHGetFileInfo再使用时就获取不到图标.
遇到不解的问题,首先查MSDN...
另外,如果使用这个函数获取其它信息,比如文件类型,那么参数里就不要再使用
SHGFI_ICON,因为这样如果不注意,后面没有DestroyIcon,同样会引起图标消失的问题
相关文章推荐
- 获取给定路径的图标,演示SHGetFileInfo用法
- SHGetFileInfo 函数用法
- 文件的本质--SHGetFileInfo()
- SPDL: SHGetSpecialFolderLocation()、SHGetFileInfo()、SHGetPathFromIDList()函数
- SHGetFileInfo 在WINCE下获得系统图标列表
- SHGetFileInfo函数详解
- Windows API——SHGetFileInfo——获取文件信息
- 获取文件图标,类型名称,属性 SHGetFileInfo
- File,FileInfo,FileStream,StreamReader的区别与用法
- CodeProject - 在C#使用SHGetFileInfo获取(管理)文件或者文件夹图标(C#封装Win32函数的一个例子)
- SHGetFileInfo函数详解
- SHGetFileInfo 获得文件类型图标
- 获取文件属性SHGetFileInfo
- 小娱乐一下,fileInfo中的Name ,FullName的用法小BUG
- SHGetFileInfo函数详解
- SHGetFileInfo获取图标说明
- SHGetFileInfo 获得文件类型图标
- SHGetFileInfo
- 详解C#中System.IO.File类和System.IO.FileInfo类的用法
- SHGetFileInfo()函数