Solved

Pointers, what do I do wrong here?

Posted on 2008-10-21
3
169 Views
Last Modified: 2010-04-05
var LPRGBTripleArray : ^TRGBTripleArray;
    LBitmapScanned : array[0..125] of ^TRGBTripleArray;
   
    i : Integer;
begin
  for i := 0 to 125 do
  begin
    LBitmapScanned[i] := MyBitmap.ScanLine[i];    
 
  end;
 
  LPRGBTripleArray := LBitmapScanned[0]; //compiler says that the type is different here, but it is ^TRGBTripleArray in both cases...
 
end;  

Thank you

panJames
 
0
Comment
Question by:panJames
[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 6

Expert Comment

by:ChristianWimmer
ID: 22768784
Define a new type called PRGBTripleArray and use it instead.
type
  PRGBTripleArray = ^TRGBTripleArray;
 
var LPRGBTripleArray : PRGBTripleArray;
    LBitmapScanned : array[0..125] of PRGBTripleArray;

Open in new window

0
 

Author Comment

by:panJames
ID: 22774357
It compiles fine now, thank you.

But what was wrong with my approach?

panJames
0
 
LVL 6

Accepted Solution

by:
ChristianWimmer earned 500 total points
ID: 22775147
You define an anonymous type (^TRGBTripleArray) for every variable declaration. Although the data structure is the same, Delphi does not consider them to be the same. They are declared twice and thus are different types. If you create a new type and let the variables use them instead, the assignment is no more a problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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