Jump to content
Software FX Community

Delphi6, ChartFx98 and 'Invalid variant operation'


User (Legacy)

Recommended Posts

I did a little digging and this is what I found:

Exception is raised on the last line of the following function in

Variants.pas:

procedure VarClearDeep(var V: TVarData);

var

LHandler: TCustomVariantType;

begin

// quick test for the simple ones

if (V.VType < varInt64) then

VarResultCheck(VariantClear(V))

...

// ok, finally is it a custom variant type?

else if FindCustomVariantType(V.VType, LHandler) then

LHandler.Clear(V)

else

VarInvalidOp;

end;

I debugged this code with ChartFx, and the reason is that V.VType

was set to 33828. That's way more then the max possible type set

in D6 to 2047.

If you look at the code that was responsible for clearing variants in Delphi

5, it seems that unknown types where just thrown at oleaut.dll and ignored,

that might be the reason that control was working in D5.

So, the working hack-around to be able to create in D6 a TChartFx object at

runtime is to change Variants.pas to ignore the unknown types.

My question is: does ChartFx control has code that is not compatible

with D6? Custom variant types need to be declared and can't be above 2047.

Or is it the way D6 retreives variants that is flawed? If anyone can provide

more

technical details about this issue, I'd appreciate that.

--

Mikhail Khilkov

Senior Software Engineer

NEC Integrated Applications Division

mkhilkov@necam.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...