?
Solved

Pointers, what do I do wrong here?

Posted on 2008-10-21
3
Medium Priority
?
176 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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

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