COM / Variants / VT_BOOL
Mark Hammond
MarkH at ActiveState.com
Thu Dec 28 07:23:14 EST 2000
Alex Martelli wrote:
> *Almost* right... but not *quite*, and we hit this specific problem
> quite recently (we weren't driving with Python, but I think that
> would have made no difference).
Quite possibly it would. If win32com had type information, it would
have dont the right thing.
> Setting the property .ValidateOnParse of the Xerces XML parser
> (originally from IBM, now, I believe, from Apache), in its COM
> setting, to 0 *or* 1, still keeps the parser non-validating; you
Without type info, the parser should call VariantChangeType() to get a
valid VT_BOOL back. So really the parser is at fault (or the client for
ignoring it)
> *Most* COM servers will happily accept 'server.BoolProp = 1'
> as setting the property to 'true', but, I suggest, don't count
> on that; use 'server.BoolProp = -1' and you might be safer.
Also, a feature of the pythoncom type conversion means that you can say:
true = 1==1
false = 1==0
And passing these variables (or the expression as a literal) _will_
force a VT_BOOL of the correct type.
Mark.
More information about the Python-list
mailing list