我有 IconHandler 来更改某些文件的图标。但其他文件图标变为空白。如何保留其他文件的默认图标?
HRESULT CSimpleShlExt::GetIconLocation(UINT uFlags,
PTSTR pszIconFile,
UINT cchMax,
int *piIndex,
UINT *pwFlags)
{
if (condition)){
// works well
lstrcpyn(pszIconFile, L"C:\\Windows\\System32\\shell32.dll", cchMax);
*piIndex = 5;
*pwFlags = 0;
} else {
// blank icon :(
*pwFlags = GIL_PERINSTANCE | GIL_NOTFILENAME;// | GIL_DONTCACHE ;
}
return S_OK;
}
这是我的 .rgs 文件:
HKCR
{
NoRemove CLSID
{
ForceRemove {B70B7A24-5180-4092-B3BA-6266F914C053} = s 'My Shell Extension'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{62C6D1EB-C172-4E05-BFD2-5F9313832CC3}'
Version = s '1.0'
}
}
NoRemove txtfile
{
NoRemove ShellEx
{
ForceRemove IconHandler = s '{B70B7A24-5180-4092-B3BA-6266F914C053}'
}
}
}