Discussion:
BDS2007 Variant gets Cleared, "Invalid Variant Type" error dialog
(too old to reply)
Larry Griffiths
2008-07-01 17:36:12 UTC
Permalink
I have some code that clears a Variant and then passes it in a method at a
later time.

The call fails before any code is executed within the failing method with an
error dialog "Invalid variant type".

I have not found any reports yet of problems related to my problem so I
thought I would ask
if anyone else is having problems with Variants using BDS2007 under Windows
XP service pack 2.

Larry Griffiths.
Larry Griffiths
2008-07-01 18:55:06 UTC
Permalink
More Information...

I am using the Variant with the __property statement.

It appears that I am getting a new instance of the Variant which is not
initialized from the Property Getter method.

I am changing the __property to do a direct move of the variable in the
__property "read=" qualifier.

If that does not work then I will move the private variable to the public
section of the class and drop its use in the property statement.

The question now becomes "Is it ok to use variants in a property statement?"

Larry Griffiths
Post by Larry Griffiths
I have some code that clears a Variant and then passes it in a method at a
later time.
The call fails before any code is executed within the failing method with
an error dialog "Invalid variant type".
I have not found any reports yet of problems related to my problem so I
thought I would ask
if anyone else is having problems with Variants using BDS2007 under
Windows XP service pack 2.
Larry Griffiths.
Larry Griffiths
2008-07-03 13:40:25 UTC
Permalink
This may not be a problem with variants.

After a couple of days of debugging I have found a class that shows its
variable values are ok when inspecting them in the object inspector inside
of the class but are offset when inspecting the variables outside of the
class. I have looked at data alignment parameters and looked for duplicate
headers for the class ect. but have not found anything yet. There is some
assembler code that I have traced that is loading a pointer to an instance
of the class that is offset by 0x10 from where the class pointer should
actually be. This may turn into one of those week long debugging episodes.

Larry Griffiths.
Post by Larry Griffiths
I have some code that clears a Variant and then passes it in a method at a
later time.
The call fails before any code is executed within the failing method with
an error dialog "Invalid variant type".
I have not found any reports yet of problems related to my problem so I
thought I would ask
if anyone else is having problems with Variants using BDS2007 under
Windows XP service pack 2.
Larry Griffiths.
Larry Griffiths
2008-07-03 16:25:23 UTC
Permalink
The problem is fixed now. We set all of our Project options to use "Integer
sized enums".

I did not research any further to determine why one unit thinks an included
header has byte sized enums and a different unit thinks the same included
header has integer sized enums.

I suppose there could be a #pragma pop missing somewhere.

Now we get to see if any problems occur switching all of our code over to
integer sized integers. Yikes!

Cross my fingers, knock on wood, you know the routine. LOL

Larry Griffiths.

Loading...