Advertisement

05.06.2008 at 03:16AM PDT, ID: 23378936
[x]
Attachment Details

Graphic.SaveToStream - Takes morethan 600ms in Delphi

Asked by pcssecure in Graphics and Delphi Programming, Delphi Programming, Delphi Programming Language

Tags: ,

Hi Experts,
I'm facing a strange problem in OCX written in Delphi 6.
What I'm trying to do is to send a Jpeg image to the host as array of Variant.

When I time the following code, Graphic.SaveToStream(strmMem) takes about 600 ms. Is there anything wrong in the way I'm code?

function TPCSTrioPRMV2.GraphicToVar(Graphic: TGraphic): Variant;
var
 strmMem : TMemoryStream;
 lpMem   : Pointer;
begin
  strmMem := TMemoryStream.Create; // Create stream for persisting graphic
  try // Resource protection
    Graphic.SaveToStream(strmMem); // Save graphic to stream
    TVariantArg(result).vt:=VT_UI1 or VT_ARRAY; // Set result vt type
    TVariantArg(result).parray := SafeArrayCreateVector(VT_UI1, 0, strmMem.Size); // Create safearray for result
    lpMem:= VarArrayLock(result); // Lock the array
    try      // Resource protection
       Move(strmMem.Memory^, lpMem^, strmMem.Size); // Move memory from the stream to the array
    finally
       VarArrayUnlock(result); // Unlock the array
    end;
  finally
    strmMem.Free; // Free the stream
  end;
end;
Start Free Trial
 
 
[+][-]05.06.2008 at 04:15AM PDT, ID: 21506235

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 04:27AM PDT, ID: 21506294

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 07:24PM PDT, ID: 21512747

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 08:11PM PDT, ID: 21512922

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 09:56PM PDT, ID: 21513266

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 12:08AM PDT, ID: 21513737

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Graphics and Delphi Programming, Delphi Programming, Delphi Programming Language
Tags: Delphi, Ver 6
Sign Up Now!
Solution Provided By: ziolko
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.09.2008 at 02:42PM PDT, ID: 21536566

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 03:21AM PDT, ID: 21545662

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:37AM PDT, ID: 21547355

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:50AM PDT, ID: 21547468

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 07:58AM PDT, ID: 21547522

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 08:11AM PDT, ID: 21547649

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 08:18AM PDT, ID: 21547721

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2008 at 10:01PM PDT, ID: 21552438

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628