Hi to all friends. i convert this code from vb6 to vb.net and raise this error "'AddressOf' expression cannot be converted to 'Long' because 'Long' is not a delegate type."
there is some code in here :
Public Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal ghmodule As Long, ByVal lpType As ResType, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Function EnumResNameProc(ByVal ghmodule As Long, ByVal lpszType As ResType, ByVal lpszName As Long, ByVal lParam As Long) As Long
Dim sNumber As String, IsNum As Boolean
If (lpszName > &HFFFF&) Or (lpszName < 0) Then
sNumber = PtrToVBString(lpszName)
IsNum = False
Else
sNumber = CStr(lpszName)
IsNum = True
End If
' 16x16
arIcon(SIZE_16, COLOR_4) = 296
arIcon(SIZE_16, COLOR_16) = 1384
arIcon(SIZE_16, COLOR_24) = 872
arIcon(SIZE_16, COLOR_32) = 1128
' 24x24
arIcon(SIZE_24, COLOR_4) = 488
arIcon(SIZE_24, COLOR_16) = 1736
arIcon(SIZE_24, COLOR_24) = 1864
arIcon(SIZE_24, COLOR_32) = 2440
' 32x32
arIcon(SIZE_32, COLOR_4) = 744
arIcon(SIZE_32, COLOR_16) = 2216
arIcon(SIZE_32, COLOR_24) = 3240
arIcon(SIZE_32, COLOR_32) = 4264
' 48x48
arIcon(SIZE_48, COLOR_4) = 1640
arIcon(SIZE_48, COLOR_16) = 3752
arIcon(SIZE_48, COLOR_24) = 7336
arIcon(SIZE_48, COLOR_32) = 9640
If IsNum Then
If lpszType = ResType.RT_ICON Then
LoadIconRes(lpszType, sNumber, giSize, giColorDepth)
End If
End If
EnumResNameProc = 1
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
....
....
For tRes = ResType.RT_FIRST To ResType.RT_LAST
Application.DoEvents()
EnumResourceNames(ghmodule, tRes, AddressOf EnumResNameProc, 0)
Next
...
End Sub
Please help me to delegate this...