Hello Tim,
Thank you very much for your fast reply and your help.
I tried your solution to get the maximum number of icons present in the executable but get the following error :
“Item does not exist”.
This is the method :
[code]Dim numIcons As Integer
#If TargetWin32 Then
numIcons = ExtractIconEx(Resource.AbsolutePath, -1, Nil, Nil, 0)
Declare Function ExtractIconExW Lib “Shell32” (Resource As WString, Index As Integer, largeIco As Ptr, smallIco As Ptr, Icons As Integer) As Integer
Declare Function DrawIconEx Lib “User32” (hDC As Integer, xLeft As Integer, yTop As Integer, hIcon As Integer, cxWidth As Integer, cyWidth As Integer, istepIfAniCur As Integer, hbrFlickerFreeDraw As Integer, diFlags As Integer) As Boolean
Declare Function DestroyIcon Lib “User32” (hIcon As Integer) As Integer
Dim theIcon As Picture = New Picture(pixsize, pixsize, 32)
theIcon.Transparent = 1
Dim largeIco As New MemoryBlock(4)
Try
Call ExtractIconExW(resource.AbsolutePath, Index, largeIco, Nil, 1)
Call DrawIconEx(theIcon.Graphics.Handle(Graphics.HandleTypeHDC), 0, 0, largeIco.Int32Value(0), pixsize, pixsize, 0, 0, &h3)
Catch
Call DestroyIcon(largeIco.Int32Value(0))
Return Nil
End Try
Call DestroyIcon(largeIco.Int32Value(0))
Return theIcon
#endif
Exception
Return Nil[/code]
Can you tell me what is wrong because I fail to see.
Thank you again very much for your support.
Friendly greetings,
Chris