mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-19 15:03:36 +08:00
Better icon-handeling.
And enumerate through ICON instead of GROUP_ICON
This commit is contained in:
parent
10204a4526
commit
60df499584
@ -243,23 +243,23 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
||||
|
||||
iconIndex = (IntPtr)sanitizeUint(iconString[1]);
|
||||
|
||||
if (iconIndex == IntPtr.Zero)
|
||||
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
|
||||
|
||||
if (iconPtr == IntPtr.Zero)
|
||||
{
|
||||
iconQueue = new Queue<IntPtr>();
|
||||
EnumResourceNamesWithID(dataFilePointer, GROUP_ICON, new EnumResNameDelegate(EnumRes), IntPtr.Zero); //Iterate through resources.
|
||||
EnumResourceNamesWithID(dataFilePointer, 3, new EnumResNameDelegate(EnumRes), IntPtr.Zero); //Iterate through resources.
|
||||
|
||||
while (iconPtr == IntPtr.Zero && iconQueue.Count > 0)
|
||||
{
|
||||
iconPtr = LoadImage(dataFilePointer, iconQueue.Dequeue(), 1, iconSize, iconSize, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
|
||||
}
|
||||
|
||||
FreeLibrary(dataFilePointer);
|
||||
|
||||
if (iconPtr != IntPtr.Zero)
|
||||
{
|
||||
try
|
||||
{
|
||||
myIcon = Icon.FromHandle(iconPtr);
|
||||
@ -267,7 +267,8 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Silently fail for now..
|
||||
//Silently fail for now.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user