<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
If you want to build in extra safety precautions (which you should,
since you never really know how the code is going to be called in the
future) you could use the Supports method (in SysUtils I think):<br>
<br>
procedure Add(AValue : OLEVariant): Integer;<br>
var<br>
&nbsp; iList : IListInterface;&nbsp; // or whatever the interface is<br>
begin<br>
&nbsp; if Supports(AValue, IListInterface, iList) then<br>
&nbsp;&nbsp;&nbsp; begin<br>
&nbsp;&nbsp;&nbsp; //do stuff with iList<br>
&nbsp;&nbsp;&nbsp; end;<br>
end;<br>
<br>
Note the use of interfaces - the TAOleCoordinateList should be handled
as an interface once it's created (otherwise it will self destroy,
being a referenced object) so you should be passing it in to the Add
method as an interface (whether as an OLEVariant of variant type
interface or just as the straight interface defined for that object).
You should also be adding it to an IInterfaceList instead of a TList.<br>
<br>
Phil.<br>
<br>
Todd Martin wrote:
<blockquote cite="mid003401c68e06$c9db2c90$8b7896ca@p2400" type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta content="MSHTML 6.00.2900.2873" name="GENERATOR">
  <style></style>
  <div><font face="Arial" size="2">Hi Andrew</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">That looks like a Softtech class
name. </font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">Make your TAOleCoordinate implement
a IOleCoordinate interface and TA</font><font face="Arial" size="2">OleCoordinateList.Add(AValue
: IOleCoordinate) : Integer</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">You can cast the interface from
IDispatch using QueryInterface()</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">Todd.</font></div>
  <div>&nbsp;</div>
  <blockquote
 style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
    <div
 style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
    <div
 style="background: rgb(228, 228, 228) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>From:</b>
    <a title="andrew@thomas.net.nz" href="mailto:andrew@thomas.net.nz">Thomas,
Andrew</a> </div>
    <div
 style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
    <a title="delphi@ns3.123.co.nz" href="mailto:delphi@ns3.123.co.nz">delphi@ns3.123.co.nz</a>
    </div>
    <div
 style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Monday, June 12, 2006 8:57 PM</div>
    <div
 style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b>
[DUG] (no subject)</div>
    <div><br>
    </div>
    <div class="Section1">
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">Hi guys,</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">I have a
quick question related to some automation work I am doing and hoped
that one of you may be able to shed light.&nbsp; Anyway I have created a new
OleCoordinate class defined as TAOleCoordinate = class(TAutoObject);
and have created a related list class defined as TAOleCoordinateList =
class(TAutoObject);</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">I have added
a method to TAOleCoordinateList called .Add(AValue: OLEVariant):
Integer which attempts to add AValue to a TList object. &nbsp;The problem is
that I don&#8217;t know how to type cast OLEVariant to TAOleCoordinate (even
though I know it is that object because I created it as such and passed
it into this method).&nbsp;</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">Anyone able
to help me in this matter?</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ"></span></font><font
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">Cheers,</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">Andrew</span></font></p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ"></span></font>&nbsp;</p>
    <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;" lang="EN-NZ">BTW - This
is in Delphi 5.</span></font></p>
    </div>
    <div>&nbsp;</div>
    <p> </p>
    <hr> _______________________________________________<br>
Delphi mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a><br>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a><br>
    <p> </p>
    <hr> No virus found in this incoming message.<br>
Checked by AVG Free Edition.<br>
Version: 7.1.394 / Virus Database: 268.8.3/361 - Release Date:
11/06/2006<br>
  </blockquote>
  <pre wrap="">
<hr size="4" width="90%">
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.3/361 - Release Date: 11/06/2006
  </pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>
  </pre>
</blockquote>
</body>
</html>