Calling VB ActiveX Control from MFC 
Author Message
 Calling VB ActiveX Control from MFC

I have an application using MFC which needs to call client COM
components which will be written by the customer using VB 5. I can
define the interface they can use. I know enough about MFC but am
lacking on the VB part.

How does the customer use the interface I have defined (I assume by
importing the typelib, but where do they go from here and how do they
implement the code ?)

Also, if the customer defines an Active X VB DLL without using my
predefined interface, I assume I can just use IDispatch to invoke the
relevant functions ?

I know this is probably not the best place to ask, since it is more VB
oriented than MFC. Any pointers on using VB components from MFC would
be appreciated.

Dominic



Sun, 09 Feb 2003 03:00:00 GMT  
 Calling VB ActiveX Control from MFC

Quote:
> How does the customer use the interface I have defined (I assume by
> importing the typelib, but where do they go from here and how do they
> implement the code ?)

In the VB IDE, there's a menu item called "Project /References".  They
would reference your type library (or DLL) there.  To them, it would
show up in the object browser.  When they go to define their own
objects, they can say "implements IMyInterface" and the VB IDE
"hooks up" your type library so they can see function signatures, etc.

Quote:

> Also, if the customer defines an Active X VB DLL without using my
> predefined interface, I assume I can just use IDispatch to invoke the
> relevant functions ?

Not necessarily.  If your interface is defined as dual (derived from
IDispatch), then yes.  Otherwise, you would not be able to use
IDispatch.

Quote:
> I know this is probably not the best place to ask, since it is more VB
> oriented than MFC. Any pointers on using VB components from MFC would
> be appreciated.

Use VARIANT_BOOL instead of BOOL or bool.   Use BSTR for string
types.  Don't use 'int', use short or long (vb int is 16 bits which causes
IDL
confusion).

Les Matheson



Mon, 10 Feb 2003 12:39:51 GMT  
 Calling VB ActiveX Control from MFC
Thanks. That is everything I need to know to get started!!

Much appreciated.

Dominic


Quote:
>> How does the customer use the interface I have defined (I assume by
>> importing the typelib, but where do they go from here and how do they
>> implement the code ?)

>In the VB IDE, there's a menu item called "Project /References".  They
>would reference your type library (or DLL) there.  To them, it would
>show up in the object browser.  When they go to define their own
>objects, they can say "implements IMyInterface" and the VB IDE
>"hooks up" your type library so they can see function signatures, etc.

>> Also, if the customer defines an Active X VB DLL without using my
>> predefined interface, I assume I can just use IDispatch to invoke the
>> relevant functions ?

>Not necessarily.  If your interface is defined as dual (derived from
>IDispatch), then yes.  Otherwise, you would not be able to use
>IDispatch.

>> I know this is probably not the best place to ask, since it is more VB
>> oriented than MFC. Any pointers on using VB components from MFC would
>> be appreciated.

>Use VARIANT_BOOL instead of BOOL or bool.   Use BSTR for string
>types.  Don't use 'int', use short or long (vb int is 16 bits which causes
>IDL
>confusion).

>Les Matheson



Mon, 10 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MFC Control OnCreate not called via VB, but called under MSVC

2. MFC app calling VB ActiveX DLL

3. Calling a VB ActiveX dll from MFC

4. Calling VB ActiveX DLL from MFC applications(Newbie question)

5. calling VB activex control from VC

6. VB script calling activeX control problem

7. Calling ActiveX control from VB

8. Help with VB ActiveX Control and MFC DLL

9. how to insert vb activex control into mfc application

10. Question: Catching errors from a VB ActiveX control in Visual C++ using MFC

11. VB ActiveX Control on a MFC VC++ Dialog.

12. Access to Arrow keys in popup dialog in MFC ActiveX control / under VB

 

 
Powered by phpBB® Forum Software