I'm adding icons to Menu items through "SHDefExtractIconW" function.
But sometimes the icons aren't what they should be.
I can't put the full code (too big), so here is the function and the call :
Code: Select all
Prototype.i ExtractArbitrarySizeIcon(pszIconFile.s, iIndex.i, uFlags.i, phiconLarge.i, phiconSmall.i, nIconSize.i)
Procedure MyCustomExtractIcon(file$, index, size)
If OpenLibrary(0, "Shell32.dll")
Protected hIcon
Protected CustomIcon.ExtractArbitrarySizeIcon
CustomIcon = GetFunction(0, "SHDefExtractIconW")
CustomIcon(file$, index, 0, @hIcon, #Null, size)
CloseLibrary(0)
ProcedureReturn hIcon
Else
ProcedureReturn 0
EndIf
EndProcedure
...
MenuItem(#contextMenu1, "example", MyCustomExtractIcon("shell32.dll", 55, 16))
...
Thanks for your time.



