Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1665
  • Last Modified:

How to use IDispatch & ITypeInfo from VB6?

At runtime, I want to query arbitrary VB "As Object" instances I'm holding, to find their property names and methods, and to fetch and set the properties.  Same for methods, and their parameters (inquiry and invoke).

VB can't handle data-driven access to IDispatch directly, nor access to ITypeInfo from the GetTypeInfo method.  Where would I find a well-documented component that would give me full access?  (Yes, I'm willing to buy a 3rd party component.)
0
JeffGrigg
Asked:
JeffGrigg
  • 3
  • 2
1 Solution
 
AzraSoundCommented:
VB6 offers the CallByName function which gives you some of this ability, if you know the property you are seeking.  you can actually grab an object's type information using the tlbinf32.dll which you select via Project -> REFERENCES and selecting TypeLib Info.  i posted a small project here that shows how to determine if a property exists for an object:
http://www.freevbcode.com/ShowCode.Asp?ID=2441

it should give you an idea on how to enumerate an object's property values.


a more full example can be found here:
http://www.vbaccelerator.com/codelib/actvxdoc/article.htm

they used the same component to create an activex documenting component.  the source code is included and should give you just about everything you are looking for.
0
 
wpsjr1Commented:
Edanmo has code to enum properties, methods and events using ITypeInfo at:

http://www.domaindlx.com/e_morcillo/default.asp


And of course there is Matt Curlands excellent .chm file explaining the TlbInf32.dll at:

ftp://ftp.microsoft.com/softlib/mslfiles/tlbinf32.exe
0
 
JeffGriggAuthor Commented:
http://www.domaindlx.com is dead, but the Microsoft help file ("Matt Curlands excellent .chm file") is very helpful.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
JeffGriggAuthor Commented:
The "ActiveX Documenter" (http://www.vbaccelerator.com/codelib/actvxdoc/article.htm) is also very interesting and relevant.  I will attempt to post partial points to AzraSound for this answer.
0
 
wpsjr1Commented:
Thanks Jeff, do try Edanmo's page again, its working here and has information you need.
0
 
JeffGriggAuthor Commented:
I can connect to http://www1.domaindlx.com/
But the pages under it all time out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now