SHFILEINFO fileInfo;
SHGetFileInfo(
    "C:\\boot.ini", NULL,
    &fileInfo,
    sizeof(SHFILEINFO),
    SHGFI_ICON|SHGFI_TYPENAME);
 
cout<<fileInfo.szTypeName<<"文件"<<endl;
cout<<"0x"<<hex<<fileInfo.hIcon<<endl;
cout<<"0x"<<hex<<fileInfo.dwAttributes<<endl;
 
/* 输出:
    配置设置文件
    0x09FC07B5
    0x40400177
*/
 
//Handle to the icon that represents the file.
//You are responsible for destroying this handle
//with DestroyIcon when you no longer need it.
DestroyIcon(fileInfo.hIcon);

本文链接地址: 用SHGetFileInfo获取文件类型/图标信息
https://blog.qingfengju.com/index.asp?id=136

上一篇: 用GetLogicalDriveStrings获取磁盘列表
下一篇: 背景为白色的只读(ReadOnly)CEdit控件

分类:Win32/C++ 查看次数:8169 发布时间:2009/8/2 16:27:09