Skip to content

Commit f733488

Browse files
committed
Fix image rendering on Win7
Fixes #1023 #90.
1 parent 9397d58 commit f733488

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Src/Lib/ResourceHelper.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,11 @@ HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, b
396396
CComPtr<IWICImagingFactory> pFactory;
397397
if (FAILED(pFactory.CoCreateInstance(CLSID_WICImagingFactory)))
398398
{
399-
if (srcBmp) DeleteObject(srcBmp);
400-
return NULL;
399+
if (FAILED(pFactory.CoCreateInstance(CLSID_WICImagingFactory1)))
400+
{
401+
if (srcBmp) DeleteObject(srcBmp);
402+
return NULL;
403+
}
401404
}
402405

403406
CComPtr<IWICBitmapSource> pBitmap;
@@ -534,7 +537,10 @@ HBITMAP LoadImageResource( HMODULE hModule, const wchar_t *name, bool bTopDown,
534537
{
535538
CComPtr<IWICImagingFactory> pFactory;
536539
if (FAILED(pFactory.CoCreateInstance(CLSID_WICImagingFactory)))
537-
return NULL;
540+
{
541+
if (FAILED(pFactory.CoCreateInstance(CLSID_WICImagingFactory1)))
542+
return NULL;
543+
}
538544

539545
CComPtr<IWICBitmapSource> pBitmap;
540546
if (hModule)

Src/StartMenu/StartMenuDLL/ItemManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ void CItemManager::LoadIconData::Init( void )
489489
HIMAGELIST_QueryInterface(m_TempLists[i],IID_IImageList2,(void**)&m_pTempLists[i]);
490490
}
491491
}
492-
m_pFactory.CoCreateInstance(CLSID_WICImagingFactory);
492+
if (FAILED(m_pFactory.CoCreateInstance(CLSID_WICImagingFactory)))
493+
m_pFactory.CoCreateInstance(CLSID_WICImagingFactory1);
493494
}
494495

495496
void CItemManager::LoadIconData::Close( void )

0 commit comments

Comments
 (0)