SHGetFileInfo(path,0,psfi,sizeof(SHFILEINFO),SHGFI_LARGEICON);
path是我的路径
psfi是这么定义的SHFILEINFOW *psfi;这句代码哪里有问题呢 ,怎么一运行就报错。
设置断点调试的话才调试两步就一样报错。
好像进入到了operator PCXSTR() const throw()
{
return( m_pszData );
}
错误为:Unhandled exception at 0x747de825 in testlistcontrol2getiteminfo.exe: 0xC0000005: Access violation writing location 0xcccccccc.
path是我的路径
psfi是这么定义的SHFILEINFOW *psfi;这句代码哪里有问题呢 ,怎么一运行就报错。
设置断点调试的话才调试两步就一样报错。
好像进入到了operator PCXSTR() const throw()
{
return( m_pszData );
}
错误为:Unhandled exception at 0x747de825 in testlistcontrol2getiteminfo.exe: 0xC0000005: Access violation writing location 0xcccccccc.
SHFILEINFOW sfi = {0};
SHGetFileInfo(path,0,&sfi,sizeof(SHFILEINFO),SHGFI_LARGEICON);
没有分配空间,函数执行会填充那个结构体。
DWORD dwRet = SHGetFileInfo(path,0,&sfi,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_LARGEICON);
试下这样。