Board index » cppbuilder » Exporting binary data from COM object

Exporting binary data from COM object

Hi,
I'm going to write my first COM object
that will be used in ASP app. The object
should generate an image and pass it to a script
by some way. Does anybody have any experience
in passing binary data from objects? Also, in ASP
app I use JScript and I don't have any ideas how
to hanlde/store this binary data in JScript code. Any ideas?
 

Re:Exporting binary data from COM object


Hmm, I'm not sure what would be a good way of doing this through COM
interfaces.  It may be possible to pass a void* to your script clients.
However, not having used JScript, I don't know how well it would handle
this.

Personally, I commonly use BSTRs to pass binary data, but this is really
only viable when dealing with C++ clients and servers - it doesn't work well
for VB or most other languages.

Question:  Do the server and client reside on the same machine ?

If so, have you considered creating a temporary file to store your image ?
You could then pass the name of the temporary file to your script and have
your script load the file from disk ?

Not the cleanest solution, but it may be a simpler, if performance isn't
critical.

Phil.

Quote
"Tumurbaatar S." <tumurbaa...@datacom.mn> wrote in message

news:3de47b9b@newsgroups.borland.com...
Quote
> Hi,
> I'm going to write my first COM object
> that will be used in ASP app. The object
> should generate an image and pass it to a script
> by some way. Does anybody have any experience
> in passing binary data from objects? Also, in ASP
> app I use JScript and I don't have any ideas how
> to hanlde/store this binary data in JScript code. Any ideas?

Re:Exporting binary data from COM object


Also, another way, may be to use a variant array.  Again, this is likely to
be inefficient but if performance is not critical it may be viable.

Quote
"Phil Parker" <ppar...@adelphia.net> wrote in message

news:3de64cd6$1@newsgroups.borland.com...
Quote
> Hmm, I'm not sure what would be a good way of doing this through COM
> interfaces.  It may be possible to pass a void* to your script clients.
> However, not having used JScript, I don't know how well it would handle
> this.

> Personally, I commonly use BSTRs to pass binary data, but this is really
> only viable when dealing with C++ clients and servers - it doesn't work
well
> for VB or most other languages.

> Question:  Do the server and client reside on the same machine ?

> If so, have you considered creating a temporary file to store your image ?
> You could then pass the name of the temporary file to your script and have
> your script load the file from disk ?

> Not the cleanest solution, but it may be a simpler, if performance isn't
> critical.

> Phil.

Re:Exporting binary data from COM object


Thank you!
It seems the right way is to obtain ASP Response object/interface
inside my COM object and write binary data directly to it bypassing
a script code. Am I right?

Quote
"Phil Parker" <ppar...@adelphia.net> wrote in message

news:3de678c4$1@newsgroups.borland.com...
Quote
> Also, another way, may be to use a variant array.  Again, this is likely
to
> be inefficient but if performance is not critical it may be viable.

> "Phil Parker" <ppar...@adelphia.net> wrote in message
> news:3de64cd6$1@newsgroups.borland.com...
> > Hmm, I'm not sure what would be a good way of doing this through COM
> > interfaces.  It may be possible to pass a void* to your script clients.
> > However, not having used JScript, I don't know how well it would handle
> > this.

> > Personally, I commonly use BSTRs to pass binary data, but this is really
> > only viable when dealing with C++ clients and servers - it doesn't work
> well
> > for VB or most other languages.

> > Question:  Do the server and client reside on the same machine ?

> > If so, have you considered creating a temporary file to store your image
?
> > You could then pass the name of the temporary file to your script and
have
> > your script load the file from disk ?

> > Not the cleanest solution, but it may be a simpler, if performance isn't
> > critical.

> > Phil.

Re:Exporting binary data from COM object


Sorry Tumurbaatar, I'm not familiar with ASP.

Phil.

Quote
"Tumurbaatar S." <tumurbaa...@datacom.mn> wrote in message

news:3dee09cb@newsgroups.borland.com...
Quote
> Thank you!
> It seems the right way is to obtain ASP Response object/interface
> inside my COM object and write binary data directly to it bypassing
> a script code. Am I right?

Other Threads