Solved

How to use IDispatch & ITypeInfo from VB6?

Posted on 2001-06-27
6
1,498 Views
Last Modified: 2007-12-19
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
Comment
Question by:JeffGrigg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 6232500
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
 
LVL 3

Accepted Solution

by:
wpsjr1 earned 60 total points
ID: 6232901
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
 

Author Comment

by:JeffGrigg
ID: 6237953
http://www.domaindlx.com is dead, but the Microsoft help file ("Matt Curlands excellent .chm file") is very helpful.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:JeffGrigg
ID: 6237999
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
 
LVL 3

Expert Comment

by:wpsjr1
ID: 6238328
Thanks Jeff, do try Edanmo's page again, its working here and has information you need.
0
 

Author Comment

by:JeffGrigg
ID: 6238590
I can connect to http://www1.domaindlx.com/
But the pages under it all time out.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Child Form in front 4 58
fso.FolderExists("\\server\HiddenFolder$") 4 89
Set email body to html using vbscript 6 71
transition to visual .net from vb6 5 64
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question