Delphi 6 application is throwing an exception when trying to use the ActiveX control and UserStrings.
Posted by Dan H, Last modified by Tanner O on 03 June 2018 08:26 PM

We have seen a case where Delphi 6 did not correctly generate the type library for the Protection PLUS 4 SDK ActiveX control.

Check the SKCLLib_TLB file generated by Delphi from the SKCL.dll ActiveX control.

Code generated by Delphi:

procedure TLFile.Set_UserString(n: Integer; const pVal: WideString); 

"Warning: UserString property has a Setter and Getter whose 

types do not match . Delphi was unable to generate a property 

this sort and therefore uses a variant to define the 

property." 


var 

InterfaceVariant: OleVariant; 

begin 

InterfaceVariant := DefaultInterface; 

InterfaceVariant.UserString := pVal;

end; 

 

Change the bold line above (InterfaceVariant.UserString := pVal;) to: 

InterfaceVariant.UserString[n] := pVal;