COleVariant’s assignment operator (operator ‘=’) does not attach the variant to the instance, but rather makes a copy of the variant. Thus the following call is losing the returned variant, and vaData only holds (and will free) a copy of it:
vaData = XceedEncryption.ReadFile ( _T ( “C:\\Test” ), 0, 0, efpDecrypt, TRUE, &ovBytesRead ); |
To correctly use COleVariants, one must use its “Attach” method instead of its assignment operator, like this:
vaData.Attach( XceedEncryption.ReadFile ( _T ( “C:\\Test” ), 0, 0, efpDecrypt, TRUE, &ovBytesRead ) ); |
Imported from legacy forums. Posted by Xceed admin (had 1782 views)