Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Values of any object's properties using TypeLib 1

Status
Not open for further replies.

BlackKnight

Programmer
Oct 18, 2000
348
US
Hi,

I am trying to retrieve the property values for a passed object.

I am using the typelib example from a thread here which allows me to get the property names but I receive an error when trying to get the property's value. Thanx in advance.

Dim Obj As New class1

Dim myTLI As TLIApplication
Dim myII As InterfaceInfo
Dim myMI As MemberInfo

Set myTLI = New TLIApplication
Set myII = TLI.InterfaceInfoFromObject(Obj)

For Each myMI In myII.Members
If myMI.InvokeKind = INVOKE_PROPERTYGET Then

'Works correctly.
Debug.Print myMI.Name

'Error occurs here:
'Invalid procedure call or argument
Debug.Print myMI.Value
End If
Next myMI

Have a good one!
BK
 
You need to look at the Invoke<xxxx> methods of the TLIApplication interface (or you can actually use VB's CallByName which is a - slightly limited but easier to use - wrapper for those methods). Here's the simplest example:

Debug.Print myTLI.InvokeHook(Obj, myMI.Name, INVOKE_PROPERTYGET)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top