Migrate to Delphi 2009 - Invalid Typecast error

delphi, delphi-2009, graphicex

Solution

"char" is now a 2 byte data type. What happens if you change the declaration to "ansichar"? (That is the equivalent of "char" in Delphi <= 2007).

Problem

I'm converting GraphicEx project to Delphi 2009. I have trouble in converting following procedure in unit Scanf_c.pas. Here is the problem: ``` With TscRec(FType) do begin ``` FType is an integer and TscRec is defined: ``` TscRec = packed record // Has size of an integer Case byte of 0: ( Typ : byte; Size : char; Flags : word;); 1: ( SizeType : word; iFlags : smallInt;); end; ``` It seems that this code is working fine in delphi 2007, but I have problem in compiling it in Delphi 2009. The compiler error is "Invalid Typecase". The problem is cause from typecasting FType which is integer to TScRec which is a record. Does somebodye here have same problem with Delphi 2009 and have a solution. Thx

Original source