Solved

GPF while assigning a TImage - why?

Posted on 1998-10-03
6
146 Views
Last Modified: 2010-04-06
I have a record in my ap which contains a TImage:

Pix = record
  P: TImage;
  Left,Top: Integer;
end;

var fp: File of Pix;
    CurrentPic: Pix;

I want to store a series of pictures on disk.  The following line causes a GPF:

CurrentPic.Picture := Image1.Picture;  

What am I doing wrong.  I am using D1 and WFW 3.11
0
Comment
Question by:jdthedj
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1341576
Hi jdthedj,

have you created memmory for CurrentPic?
like :

PPix = ^TPix;
TPix = record
  P: TImage;
  Left,Top: Integer;
end;

var fp: File of TPix;
    CurrentPic: PPix;

begin
New(CurrentPic);
CurrentPic.Picture.Assign(Image1);
{OR? CurrentPic^.Picture := Image1.Picture;   }

.

end;

{don't forget to free them when finished!}

Zif.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341577
You need to use

CurrentPic.P := Image1.Picture;

Vik
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341578
Pix is a record not an image that's why you need to use it's property P as I showed you above which is the image,,,,,

Actually this is the one that you need ,,,,,

CurrentPic.P.Picture := Image1.Picture;

//Vik
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 3

Author Comment

by:jdthedj
ID: 1341579
Hi Viktornet - thanks for replying

Hello ZifNab - thanks for the answer.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1341580
There is actually an easier way that i haven't tested but is 100% easier....

CurrentPic.P.Assign(Image1.Picture);

:->
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1341581
No prob. :-)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wininet read php file from internet issue 6 91
Sending Gmail through Delphi 3 107
Connection between libmysql.dll and MySQL Versions 7 97
Delphi...Split view - idea? 1 68
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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