Click to See Complete Forum and Search --> : How to call COM components in VB client.
kiru
December 15th, 1999, 11:51 PM
Hi,
I have a simple COMcomponent which implements the method Sum(), which is developed in VC++ environment.
I wanted to write a VB client for it. Can any body tell me how to call COM interfaces through VB .
Thanx
kiru
Lothar Haensler
December 16th, 1999, 01:30 AM
go to Project/References menu in the VB Development Environment and add you COM component's Typelib (probably part of your COM DLL) to the references.
Then hit F2 to start the object browser.
You can see all objects and methods of that component.
Instantiate an object of your component:
dim x as new yourprogid
(or use: set x = createobject("yourprogid"))
call the method
dim lResult as long
lResult = x.Sum
kiru
December 16th, 1999, 02:01 AM
Thanx for replying.
Can U suggest me some books for VB with COM or some sites on net or articles in MSDN.
Once again Thanking U
kiru
Lothar Haensler
December 16th, 1999, 02:03 AM
the best source that I know of is: MSDN and the online documentation that comes with VB.
You might also want to check out the MSPress site for some VB books.
AndyK
December 16th, 1999, 05:00 PM
You don't have to buy any books tho, www.informit.com ...sign up and read almost anybook for FREE, including those on COM components
kiru
December 21st, 1999, 07:26 AM
HI,
I tried creating Com object through the CreateObject() function in VB. But it is givng an error "Activex component can't create object".
I tried same with VB script. It is working fine.
Can U tell me what is the problem in VB.
Thanx
kiran
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.