求助!枚举资源问题
小弟想用EnumResourceNames来枚举图标资源等,代码如下
窗体:
Public Sub Form_Load() EnumResourceNames 0&, RT_ICON, AddressOf EnumNamesFunc, 0&End Sub
Public Function EnumNamesFunc(ByVal hModule As Long, ByVal lpType As Long, ByVal lpName As Long, ByVal lParam As Long) As Boolean Debug.Print lpName EnumNamesFunc = True End Function
'模块Public Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal hModule As Long, ByVal lpType As Any, ByVal lpEnumFunc As Long, ByVal lParam As Long) As LongPublic Const RT_ICON = 3&Public Function EnumNamesFunc(ByVal hModule As Long, ByVal lpType As Long, ByVal lpName As Long, ByVal lParam As Long) As Boolean Debug.Print lpName EnumNamesFunc = True End Function'窗体Private Sub Form_Load() EnumResourceNames 0&, RT_ICON, AddressOf EnumNamesFunc, 0&End Sub'反复验证,若ByVal lpType As string 无反应,ByVal lpType As Any,输出一串数字
[解决办法]
Public Enum ResType 'Types of resources
RT_FIRST = 1&
RT_CURSOR = 1&
RT_BITMAP = 2&
RT_ICON = 3&
RT_MENU = 4&
RT_DIALOG = 5&
RT_STRING = 6&
RT_FONTDIR = 7&
RT_FONT = 8&
RT_ACCELERATOR = 9&
RT_RCDATA = 10&
RT_MESSAGETABLE = (11)
RT_GROUP_CURSOR = (RT_CURSOR + DIFFERENCE)
RT_GROUP_ICON = (RT_ICON + DIFFERENCE)
RT_VERSION = (16)
'RT_DLGINCLUDE = (17)
'RT_PLUGPLAY = (19)
'RT_VXD = (20)
'RT_ANICURSOR = (21)
'RT_ANIICON = (22)
'RT_HTML = (23)
RT_LAST = (16)
End Enum
Public Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal HModule As Long, ByVal lpType As ResType, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long