Delphi, olevariants and arrays of strings -


I have an object object that is created with (simple verion)

  Obj: = CreateOleObject ('foo.bar'); Obj.OnResult: = DoOnResult; Process TMyDM.DoOnResult (Res: olevariant);  

Whatever works, the race variable has a function string [] GetAns () which calls this way

  var Ans: array of strings; Start ans: = Res.GetAns; End;  

Which works again .. except sometimes an array is returned, and then an exception is thrown.

As a temporary solution I have left the block and wrapped it in an empty triangle, which I know bad I VarIsArray (Res.GetAns) < / Em>, but the result is still zero if it is still working

What is the correct way to check for the correct result?

ps I have no control over object objects

< P> Christopher Function

Process TMyDM.DoOnResult (Res: olevariant); Var ans: Wire array; If it does not start then VarIsNull (Res), if not VarIsNull (Res.GetAns) then start ans: = Res.GetAns; // the end of your luggage; End;

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -