BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to stream/write buffer contents in IPictureDisp?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Perry Way
Guest





PostPosted: Sat Nov 22, 2003 12:42 am    Post subject: How to stream/write buffer contents in IPictureDisp? Reply with quote



I have a need to do something a little unusual. I am writing a middle-ware
piece that needs to deliver a stream of graphic data that is only obtained
through an IPictureDisp interface. Instead of using existing DCOM for
communications (platform specific) we need to use a proprietary protocol
that rides on top of raw TCP sockets (any platform). The specifics behind
the proprietary protocol are irrelevant in this case, but even if it was
relevant we are finding zero problems/errors with the protocol. I just
bring this up so someone doesn't answer this post with "why don't you just
call CreateRemoteComObject() on your client?".

I am retrieving the picture from the COM server just fine. I can show the
image using a TPicture pointer and calling SetOlePicture(). I am assuming
that (from all the articles I've read) that since I have a pointer to the
IPictureDisp interface, I can then convert the pointer to IPicture interface
like so...

var
pd: IPictureDisp;
p: IPicture;

begin
{assignment of pd from a COM server occurs here. zero errors so far.}
p := (pd as IPicture); // no error, pointer seems valid..
p.SaveAsFile() // fails.. HRResult is invalid and cbSize is set to Zero
end;


In the roughed out example above, "p" does point to something, the address
is slightly off from the address of "pd". I can call all methods and set
properties to "p", fine thus leading me to think everything is good to go.
But when I call p.SaveAsFile(), the out variable cbSize is set to Zero! So
I am not getting the native graphic data.. BUT SetOlePicture() works..
so.... Before I go kick the dog and break things (hehe), what pray tell am I
doing wrong?

Thanks,

PW


Back to top
Walter Prins
Guest





PostPosted: Sat Nov 22, 2003 11:26 pm    Post subject: Re: How to stream/write buffer contents in IPictureDisp? Reply with quote




"Perry Way" <no.delphipro.spam (AT) no (DOT) spam.earthlink.net> wrote

Quote:
In the roughed out example above, "p" does point to something, the address
is slightly off from the address of "pd". I can call all methods and set
properties to "p", fine thus leading me to think everything is good to go.
But when I call p.SaveAsFile(), the out variable cbSize is set to Zero!
So
I am not getting the native graphic data.. BUT SetOlePicture() works..
so.... Before I go kick the dog and break things (hehe), what pray tell am
I
doing wrong?

Out of interest, does it work if you call SaveToFile on the Disp (pd)
reference?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.541 / Virus Database: 335 - Release Date: 14/11/2003



Back to top
Perry Way
Guest





PostPosted: Mon Nov 24, 2003 4:47 pm    Post subject: Re: How to stream/write buffer contents in IPictureDisp? Reply with quote



"Walter Prins" wrote

Quote:
"Perry Way" wrote
In the roughed out example above, "p" does point to something, the
address
is slightly off from the address of "pd". I can call all methods and
set
properties to "p", fine thus leading me to think everything is good to
go.
But when I call p.SaveAsFile(), the out variable cbSize is set to Zero!
So
I am not getting the native graphic data.. BUT SetOlePicture() works..
so.... Before I go kick the dog and break things (hehe), what pray tell
am
I
doing wrong?

Out of interest, does it work if you call SaveToFile on the Disp (pd)
reference?

No, because ... that method is not exposed through the IPictureDisp
interface, thus my reason for trying to convert the interface somehow to
IPicture interface, where the method is exposed. My understanding was that
the IPictureDisp carries an IPicture interface internally, thus if I had a
handle to it I could convert to IPicture (I've seen a lot of vb code
examples interchanging references like that).. but I think there's something
inherently different about the Delphi implementation.... perhaps.

Where were you going with your question though? Perhaps the reason for your
asking might yield some more clues for me.

Thanks,

PW





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.