1. Start a new Standard.Exe project.
2. Add a Reference (VB Menu -> Project -> References) to "TypeLib Information"
3. Add a Listbox (List1) to Form1.
4. Copy/Paste the following into the Form1 code window.
5. Press F5 to run. All of the properties for List1 will be displayed in the Listbox.
<----- Code Begin ----->
Option Explicit
Private Sub Form_Load()
With Screen
Me.Move 0.25 * .Width, 0.25 * .Height, 0.5 * .Width, 0.5 * .Height
End With
Call xPropertyList(List1, List1)
End Sub
Private Sub Form_Resize()
With Me
If .WindowState = vbMinimized Then Exit Sub
List1.Move 0, 0, .ScaleWidth, .ScaleHeight
End With
End Sub
Public Sub xPropertyList(ByRef lstOutput As ListBox, ByRef QueriedObject As Object)
Dim TLInfo As TLI.InterfaceInfo
Dim SR As TLI.SearchResults
Dim SI As SearchItem
Dim lngReturn As Long
On Error GoTo ErrorHandler
' grab info from object
Set TLInfo = TLI.InterfaceInfoFromObject(QueriedObject)
Set SR = TLInfo.Members.GetFilteredMembers(False)
' Loop through attribute members of the object
For Each SI In SR
lngReturn = SI.InvokeKinds
' check if it is a property
' If you want to use this to check for a
' function or sub, also check if lngReturn = 1
Select Case lngReturn
Case 2, 6, 10, 12, 14
lstOutput.AddItem SI.Name
End Select
Next SI
ErrorHandler:
Set TLInfo = Nothing
End Sub
<----- Code End ----->