What about
  ref2 := ref1 as IStream;  ??

If the variant has been passed from VBScript (or something else) it will be
either a IUnknown or IDispatch interface rather than a IStream. an
OLEVaraiant does not hold any arbitrary interface only.

Suggest you do a cast using tagVariant to check the actual types etc of the
variant.

Myles.



> -----Original Message-----
> From: Wilfred Verkley [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, August 29, 2000 9:51 AM
> To:   Multiple recipients of list delphi
> Subject:      [DUG]:  Help
> 
> Hi all.
> 
> Im having some trouble type-converting OleVariants (OleDeviants would
> probably be more correct).
> 
> I have an OleVariant reference which i know points to a IStream object.
> How
> can I convert this to a variable of IStream?
> 
> i.e.
> 
> var
>   ref1 : OleVariant;
>   ref2 : IStream;
> begin
>   ref2 := IStream (ref1); // doesnt work
> end;
> 
> 
> Thanks in advance,
> 
> Wilfred.
> --------------------------------------------------------------------------
> -
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to