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,31 +243,32 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
|
|
||||||
iconIndex = (IntPtr)sanitizeUint(iconString[1]);
|
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>();
|
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)
|
while (iconPtr == IntPtr.Zero && iconQueue.Count > 0)
|
||||||
{
|
{
|
||||||
iconPtr = LoadImage(dataFilePointer, iconQueue.Dequeue(), 1, iconSize, iconSize, 0);
|
iconPtr = LoadImage(dataFilePointer, iconQueue.Dequeue(), 1, iconSize, iconSize, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeLibrary(dataFilePointer);
|
FreeLibrary(dataFilePointer);
|
||||||
|
|
||||||
try
|
if (iconPtr != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
myIcon = Icon.FromHandle(iconPtr);
|
try
|
||||||
myIcon = (Icon)myIcon.Clone(); //Remove pointer dependancy.
|
{
|
||||||
}
|
myIcon = Icon.FromHandle(iconPtr);
|
||||||
catch
|
myIcon = (Icon)myIcon.Clone(); //Remove pointer dependancy.
|
||||||
{
|
}
|
||||||
//Silently fail for now..
|
catch
|
||||||
|
{
|
||||||
|
//Silently fail for now.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user