如:如题,有什么方法?xiexie
解决方案 »
- SendMessage截去了鼠标信息怎么办?
- 如何可得到学生表中学生人数到文本框text1中?
- VB求助,关于split()函数的,哪位大虾帮忙解决下!!!
- 大虾们来帮帮小弟吧!
- 学好VB 关键在哪
- 请问在VB。NET里怎么实现原VB6里OLE CONTAINER的功能?
- 一个简单问题,实在想不通,请指教
- 如何用VB修改文本文件里面的数据并保存为另一文本文件?
- 神!救救我吧!我给一个程序打包后,怎么再另外一台机子上安装出现msado21.tlb没有注册?
- 关于在VB中显示WORD文档并能提供编辑功能的问题!!!
- 关于几个API的用法.
- 在线等待!带逗号分隔符的数字字符串怎样转换成数值型的,请高手帮助
http://www.vb-helper.com/howto_get_property_information.html
详细情况请查询MSDN
Keywords control property, property information, TypeLib
Categories Controls, Software Engineering
Thanks to Oigres P.
Set a project reference to the TypeLib Information library. Create a TLIApplication object and get an InterfaceInfo object for the control from its InterfaceInfoFromObject function. Then iterate through the interface's members.
Private Sub Command1_Click()
''caution crashes if you try to read the Form1
' properties
iterateMembers Text1
End SubSub iterateMembers(obj As Object)
'iterate the members in the textbox interface
'put them in a flexgrid for viewing
Dim TLI As New TLIApplication, ret As Variant
Dim interface As InterfaceInfo
Dim member As MemberInfo On Error Resume Next
Set interface = TLI.InterfaceInfoFromObject(obj)
Dim index As Long, tempstr As String
ReDim str(interface.Members.Count) As String index = 0
For Each member In interface.Members
tempstr = ""
tempstr = tempstr & member.Name & vbTab & _
member.VTableOffset & vbTab & _
Hex$(member.MemberId) & _
vbTab & member.HelpString
'get property value; using memberID is faster than
' member.Name
ret = TLI.InvokeHook(Text1, member.MemberId, _
INVOKE_PROPERTYGET)
'adjust long values; convert to hex (else shows neg
' value)
If TypeName(ret) = "Long" Then
ret = "&H" & Hex(ret) & "&"
tempstr = tempstr & vbTab & ret & vbTab & "long"
Else
tempstr = tempstr & vbTab & ret & vbTab & _
TypeName(ret)
End If
'store row data in array
str(index) = tempstr
index = index + 1 Next Set TLI = Nothing
fillGrid str()
End Sub