首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

!枚举资源有关问题

2012-03-09 
求助!枚举资源问题小弟想用EnumResourceNames来枚举图标资源等,代码如下窗体:VB codePublic Sub Form_Load

求助!枚举资源问题
小弟想用EnumResourceNames来枚举图标资源等,代码如下
窗体:

VB code
Public Sub Form_Load()     EnumResourceNames 0&, RT_ICON, AddressOf EnumNamesFunc, 0&End Sub

函数:
VB code
     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

声明就省略了

目前的问题是,这段如此简短的代码运行之后无任何反应。。。

[解决办法]
VB code
 '模块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

热点排行