I’m trying to grab the default application icon for use elsewhere in my app. Since it is going to be used in several apps I’m doing, I want it to be generic. I’m using the following Windows Declare function and code. The variable info
and its data are being defined and sourced elsewhere.
[code]Declare Function DrawIconEx Lib “User32” (hDC As Integer, xLeft As Integer, yTop As Integer, hIcon As Integer, cxWidth As Integer, _
cyWidth As Integer, StepIfAniCur As Integer, FlickerFreeDraw As Integer, Flags As Integer) As Boolean
Dim bool As Boolean
Dim ico As New Picture (32, 32, 32)
Dim hIcon As Integer = info.Int32Value (0)
#If XojoVersion < 2019.2 Then
Bool = DrawIconEx (ico.Graphics.Handle (1), 0, 0, hIcon, 32, 32, 0, 0, &h3) ’ This works
#Else
Bool = DrawIconEx (ico.Graphics.HandleTypeHDC, 0, 0, hIcon, 32, 32, 0, 0, &h3) 'This fails
#Endif[/code]
The first version, for 2019r1.1 and earlier, works fine. The second version, for 2019r2, fails in execution but not at compile time.
I guess I don’t really understand the translating of enums in cases like this or, perhaps, I’ve encountered a bug that I just don’t know enough to be able to recognize. Either way, if someone could point me in the right direction I would appreciate it.