This is driving m crazy ... I am storing the bytes of an icon file in a Byte array and then trying to create the icon with the CreateIconFromResourceEx API but for some annoying reason, it is not returning the icon handle.
This is the straightforward code I am using:
I also tried CreateIconFromResourceEx(bData(0), UBound(bData) * 4 + 1&, 1&, &H30000, 0, 0, 0&)
Still not working!
I really don't see what might be causing the problem... Can anybody please, tell me what I am doing wrong ?
Thanks.
This is the straightforward code I am using:
Code:
Private Declare Function CreateIconFromResourceEx Lib "user32.dll" _
(ByRef presbits As Any, ByVal dwResSize As Long, ByVal fIcon As Long, ByVal dwVer As Long, _
ByVal cxDesired As Long, ByVal cyDesired As Long, ByVal Flags As Long) As Long
Sub CRAZY()
Dim fileNum As Integer
Dim bData() As Byte
fileNum = FreeFile
Open "C:\Users\Info-Hp\Downloads\MyIcon.ico" For Binary As fileNum
ReDim bData(0 To LOF(fileNum) - 1&)
Get fileNum, , bData()
Close fileNum
'CreateIconFromResourceEx Returns 0 !!!
MsgBox CreateIconFromResourceEx(bData(0), UBound(bData) * 4 + 4, 1&, &H30000, 0, 0, 0&)
End Sub
Still not working!
I really don't see what might be causing the problem... Can anybody please, tell me what I am doing wrong ?
Thanks.