Board index » cppbuilder » Passing binary data via dispatch interface

Passing binary data via dispatch interface

Hiya

I've written a COM server/client using a dispatch interface.
It seems to be working fine so far, the I've come across
a problem when I want to pass a block of binary data
between the server and client.

I can't use a custom interface since it's important for me
to support languages like VB/VBA.  I've seen solutions
that use horribly complicated workarounds
(http://codeguru.earthweb.com/atl/BufferVariant.html),
but I can't belive there isn't an easier way.

Can't you pass eg. a reference to a Byte array, or use
a BSTR?  The latter includes a length count, so in
theory it can contain binary data.

Thanks for any suggestions,

 --
C-YA
Jon

<http://www.witchspace.com>

 

Re:Passing binary data via dispatch interface


Hi Jon,

yes a BSTR can be used to pass binary data - as you say it has a length count.

I'm not sure however, how well this is handled by Visual Basic.  You may want to
write a little test program to check it out.

Phil.

On 23 Mar 2001 06:50:47 -0800, "Jonathan Belson" <j...@witchspace.com> wrote:

Quote

>Hiya

>I've written a COM server/client using a dispatch interface.
>It seems to be working fine so far, the I've come across
>a problem when I want to pass a block of binary data
>between the server and client.

>I can't use a custom interface since it's important for me
>to support languages like VB/VBA.  I've seen solutions
>that use horribly complicated workarounds
>(http://codeguru.earthweb.com/atl/BufferVariant.html),
>but I can't belive there isn't an easier way.

>Can't you pass eg. a reference to a Byte array, or use
>a BSTR?  The latter includes a length count, so in
>theory it can contain binary data.

>Thanks for any suggestions,

> --
>C-YA
>Jon

><http://www.witchspace.com>

Re:Passing binary data via dispatch interface


Quote
par...@sensormatic.com (Phil Parker) wrote:
>Hi Jon,

>yes a BSTR can be used to pass binary data - as you say it has a length count.

>I'm not sure however, how well this is handled by Visual Basic.  You may want to
>write a little test program to check it out.

Just found out that it won't work 8^(  Check out
"Passing Structures in OLE Automation", PSS ID Number: Q122289

Does anyone have any other suggestions?

--
C-YA
Jon

<http://www.witchspace.com>

Other Threads