获取文件属性SHGetFileInfo
2012-11-30 16:43
369 查看
1:文件/文件夹 显示的图标:
#include <GdiPlus.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus.lib")
void CTestGetFileICONDlg::ShowFileIcon( CString strFile )
{
// TODO: Add your control notification handler code here
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// strFile = "G:\\audio.mp3";
SHFILEINFO info;
SHGetFileInfo( strFile, 0, &info,sizeof(&info), SHGFI_DISPLAYNAME | SHGFI_ICON);
Bitmap pic( info.hIcon );
Graphics g(this->m_hWnd);
g.DrawImage(&pic, 0, 0);
}
#include <GdiPlus.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus.lib")
void CTestGetFileICONDlg::ShowFileIcon( CString strFile )
{
// TODO: Add your control notification handler code here
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// strFile = "G:\\audio.mp3";
SHFILEINFO info;
SHGetFileInfo( strFile, 0, &info,sizeof(&info), SHGFI_DISPLAYNAME | SHGFI_ICON);
Bitmap pic( info.hIcon );
Graphics g(this->m_hWnd);
g.DrawImage(&pic, 0, 0);
}
相关文章推荐
- 【MoreWindows工作笔记4】 获取文件图标,类型名称,属性 SHGetFileInfo
- 获取文件图标,类型名称,属性 SHGetFileInfo
- Windows API——SHGetFileInfo——获取文件信息
- CodeProject - 在C#使用SHGetFileInfo获取(管理)文件或者文件夹图标(C#封装Win32函数的一个例子)
- Windows API——SHGetFileInfo——获取文件信息
- CodeProject - 在C#使用SHGetFileInfo获取(管理)文件或者文件夹图标(C#封装Win32函数的一个例子)
- 使用SHGetFileInfo函数获取任何文件大图标
- 收藏——在C#使用SHGetFileInfo获取(管理)文件或者文件夹图标(C#封装Win32函数的一个例子)
- Windows API——SHGetFileInfo——获取文件信息
- SHGetFileInfo(获取文件信息)
- FileInfo 0.0.0005--masm32写的获取文件属性、版本、时间、MD5、SHA1 等信息的小程序
- Windows API——SHGetFileInfo——获取文件信息
- C#获取文件(磁盘驱动器)的关联图标(使用API SHGetFileInfo)
- 获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)
- 【转】取文件属性:GetFileVersionInfoSize,GetFileVersionInfo,VerQueryValue三个函数的配合
- Perl基本技三:斯德艾特——File::stat->stat()函数获取文件属性信息
- [InstallShield]FindAllFiles与SetFileInfo配合实现文件加多文件属性设置
- 文件的本质--SHGetFileInfo()
- 获取 E盘下所有文件的文件名;关于 File 对象的属性;关于 FileWriter 对象的属性;
- 关于获取info.plist文件的属性和获取资源管理xcassets里的启动图片的问题