?
Solved

COM, IPICTURE, PICTURE, how to pass graphics from COM?

Posted on 2003-03-06
3
Medium Priority
?
294 Views
Last Modified: 2010-08-05
hi. I'd like to create a COM/MTS object that can pass a JPEG picture or stream to ASP.
I hear many things about IStream but I can't find any IStream in the 'Type Library' window.
Please Help. Thanks
0
Comment
Question by:zzzxtreme
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Lee_Nover earned 1000 total points
ID: 8086977
asp can use an IPicture interface .. well VB does so I'm guessing asp can as well :)
so .. simply use:
GetOlePicture(MyDelphiPicture, OutputIPicture)
if the procedure fails OutputIPicture is nil
it's in the AxCtrls unit
from the help:
The Picture parameter is a pointer to the native TPicture. This can be the Picture property of a VCL control.  The OLE picture is returned in the OlePicture parameter. The resulting OLE picture object is a direct connection to the native VCL picture, so changing the OLE picture's properties will change the TPicture's properties, and vice-versa.

if you still want to go with IStream then this could help:
uses classes, jpeg, activex;

function GetJPEGStream: IStream;
var jpg: TJPEGImage;
    ms: TMemoryStream;
    sa: TStreamAdapter;
begin
     jpg:=TJPEGImage.Create;
     try
        ms:=TMemoryStream.Create;
        try
           jpg.SaveToStream(ms);
           ms.Seek(0, soFromBeginning);
           sa:=TStreamAdapter.Create(ms);
           try
              Result:=sa;
           finally
              sa.Free;
           end;
        finally
           ms.Free;
        end;
     finally
        jpg.Free;
     end;
end;

haven't worked with this so I don't know how the memory is managed and how to free the streams correctly
check that out
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 8086982
ah . in the GetJPEGStream function .. ofcourse after creating the jpeg you load it from somwhere :)
a file most probably
0
 
LVL 4

Expert Comment

by:MrGhost
ID: 8087174
you can't use istream if you going to use out of process communication you need to somthing else variant or safearray ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question