passing pointer to a VC-COM from VB 
Author Message
 passing pointer to a VC-COM from VB

I have created a COM component in VC++
Now one of the functions takes a int* and changes its value
When i call it from VB I use a Long ( which is supposed to
be passed using ByRef automatically), but i do not get
a changed value when the call finishes.
Does VB created a copy and then send the variable pointer???
What is the general way of dealing with pointers when creating a component
in VC which will be accessed ifrom VB also?
Typically number of functions may require to pass back values to caller in
strings, integers and arrays, so what is the general COM defintiion which
wil allow this both from VC as well as from VB

rgds
Vikash



Sun, 31 Aug 2003 20:22:28 GMT  
 passing pointer to a VC-COM from VB
try

call obj.function lparam

regards

mihai



Quote:
> I have created a COM component in VC++
> Now one of the functions takes a int* and changes its value
> When i call it from VB I use a Long ( which is supposed to
> be passed using ByRef automatically), but i do not get
> a changed value when the call finishes.
> Does VB created a copy and then send the variable pointer???
> What is the general way of dealing with pointers when creating a component
> in VC which will be accessed ifrom VB also?
> Typically number of functions may require to pass back values to caller in
> strings, integers and arrays, so what is the general COM defintiion which
> wil allow this both from VC as well as from VB

> rgds
> Vikash



Sun, 31 Aug 2003 22:56:18 GMT  
 passing pointer to a VC-COM from VB
yes. supposing of course the VC COM is corectly written.



Quote:
> I could not follow as to what change have u suggested upon my existing
call.
> Are u trying to say that a call without the brackets will do it



> > try

> > call obj.function lparam

> > regards

> > mihai



> > > I have created a COM component in VC++
> > > Now one of the functions takes a int* and changes its value
> > > When i call it from VB I use a Long ( which is supposed to
> > > be passed using ByRef automatically), but i do not get
> > > a changed value when the call finishes.
> > > Does VB created a copy and then send the variable pointer???
> > > What is the general way of dealing with pointers when creating a
> component
> > > in VC which will be accessed ifrom VB also?
> > > Typically number of functions may require to pass back values to
caller
> in
> > > strings, integers and arrays, so what is the general COM defintiion
> which
> > > wil allow this both from VC as well as from VB

> > > rgds
> > > Vikash



Sun, 31 Aug 2003 23:09:48 GMT  
 passing pointer to a VC-COM from VB
I could not follow as to what change have u suggested upon my existing call.
Are u trying to say that a call without the brackets will do it


Quote:
> try

> call obj.function lparam

> regards

> mihai



> > I have created a COM component in VC++
> > Now one of the functions takes a int* and changes its value
> > When i call it from VB I use a Long ( which is supposed to
> > be passed using ByRef automatically), but i do not get
> > a changed value when the call finishes.
> > Does VB created a copy and then send the variable pointer???
> > What is the general way of dealing with pointers when creating a
component
> > in VC which will be accessed ifrom VB also?
> > Typically number of functions may require to pass back values to caller
in
> > strings, integers and arrays, so what is the general COM defintiion
which
> > wil allow this both from VC as well as from VB

> > rgds
> > Vikash



Sun, 31 Aug 2003 22:52:36 GMT  
 passing pointer to a VC-COM from VB
Gr8 That does the trick
1. What is the suggested way of getting back string values from my COM
component in both VC & VB. Should I use BSTR or VARIANT and why?
2. If I wanna invoke my component from scripts also, how do i go about it.
What is a dual interface?

rgds
vikash


Quote:
> yes. supposing of course the VC COM is corectly written.



> > I could not follow as to what change have u suggested upon my existing
> call.
> > Are u trying to say that a call without the brackets will do it



> > > try

> > > call obj.function lparam

> > > regards

> > > mihai



> > > > I have created a COM component in VC++
> > > > Now one of the functions takes a int* and changes its value
> > > > When i call it from VB I use a Long ( which is supposed to
> > > > be passed using ByRef automatically), but i do not get
> > > > a changed value when the call finishes.
> > > > Does VB created a copy and then send the variable pointer???
> > > > What is the general way of dealing with pointers when creating a
> > component
> > > > in VC which will be accessed ifrom VB also?
> > > > Typically number of functions may require to pass back values to
> caller
> > in
> > > > strings, integers and arrays, so what is the general COM defintiion
> > which
> > > > wil allow this both from VC as well as from VB

> > > > rgds
> > > > Vikash



Mon, 01 Sep 2003 15:25:53 GMT  
 passing pointer to a VC-COM from VB



Quote:
> Gr8 That does the trick
> 1. What is the suggested way of getting back string values from my COM
> component in both VC & VB. Should I use BSTR or VARIANT and why?

You can use whatever do you want according to your needs. Of course, BSTR
seems to be more appropiate than VARIANT for the same reasons you are using
(VB) String data type vs (VB) Variant data type.

Quote:
> 2. If I wanna invoke my component from scripts also, how do i go about it.

Using VARIANT in your COM is one ideea.

Quote:
> What is a dual interface?

An interface that supports both IDispatch and VTBL binding. See MSDN for
more details, the subject is too large for a post.

hth
mihai

Quote:

> rgds
> vikash



> > yes. supposing of course the VC COM is corectly written.



> > > I could not follow as to what change have u suggested upon my existing
> > call.
> > > Are u trying to say that a call without the brackets will do it



> > > > try

> > > > call obj.function lparam

> > > > regards

> > > > mihai



> > > > > I have created a COM component in VC++
> > > > > Now one of the functions takes a int* and changes its value
> > > > > When i call it from VB I use a Long ( which is supposed to
> > > > > be passed using ByRef automatically), but i do not get
> > > > > a changed value when the call finishes.
> > > > > Does VB created a copy and then send the variable pointer???
> > > > > What is the general way of dealing with pointers when creating a
> > > component
> > > > > in VC which will be accessed ifrom VB also?
> > > > > Typically number of functions may require to pass back values to
> > caller
> > > in
> > > > > strings, integers and arrays, so what is the general COM
defintiion
> > > which
> > > > > wil allow this both from VC as well as from VB

> > > > > rgds
> > > > > Vikash



Mon, 01 Sep 2003 18:55:57 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. how to convert the pointer and address of pointer in vc to vb

2. EASY Way to Pass SAFEARRAY from VC to VB using COM

3. how to convert the pointer and address of pointer in vc to vb

4. VC-COM from VB/VC/Script

5. Passing COM interface pointers in VB

6. Passing pointer to pointer to C struct from VB into a DLL

7. Passing pointer to a pointer or pointer to a char to a dll

8. How to pass a pointer to a COM object in VBScript

9. How can I declare and use pointers in VB as it is possible in VC

10. VB/VC COM dll/ who owns the memory?

11. about VB function call VC COM

12. Passing String Arrays between VB and VC

 

 
Powered by phpBB® Forum Software