772 lines
30 KiB
HTML
772 lines
30 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<link rel=stylesheet type="text/css" href="styles.css">
|
|
</head>
|
|
<body>
|
|
<H3>
|
|
TPaxInvoke Methods
|
|
</H3>
|
|
<hr>
|
|
<ul>
|
|
<li><a href="#TPaxInvoke.Create">Create</a></li>
|
|
<li><a href="#TPaxInvoke.Destroy">Destroy</a></li>
|
|
<li><a href="#TPaxInvoke.LoadAddress">LoadAddress</a></li>
|
|
<li><a href="#TPaxInvoke.ClearArguments">ClearArguments</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsByte">AddArgAsByte</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsWord">AddArgAsWord</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsCardinal">AddArgAsCardinal</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsShortInt">AddArgAsShortInt</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsSmallInt">AddArgAsSmallInt</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsInteger">AddArgAsInteger</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsInt64">AddArgAsInt64</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsLongBool">AddArgAsLongBool</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsWordBool">AddArgAsWordBool</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsBoolean">AddArgAsBoolean</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsChar">AddArgAsChar</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsWideChar">AddArgAsWideChar</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsDouble">AddArgAsDouble</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsSingle">AddArgAsSingle</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsExtended">AddArgAsExtended</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsCurrency">AddArgAsCurrency</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsAnsiString">AddArgAsAnsiString</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsWideString">AddArgAsWideString</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsShortString">AddArgAsShortString</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsPChar">AddArgAsPChar</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsPWideChar">AddArgAsPWideChar</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsPointer">AddArgAsPointer</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsRecord">AddArgAsRecord</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsRecordByVal">AddArgAsRecordByVal</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsArray">AddArgAsArray</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsArrayByVal">AddArgAsArrayByVal</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsDynArray">AddArgAsDynArray</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsObject">AddArgAsObject</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsClassRef">AddArgAsClassRef</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsVariant">AddArgAsVariant</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsSet">AddArgAsSet</a></li>
|
|
<li><a href="#TPaxInvoke.AddArgAsInterface">AddArgAsInterface</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsVoid">SetResultAsVoid</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsByte">SetResultAsByte</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsWord">SetResultAsWord</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsCardinal">SetResultAsCardinal</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsShortInt">SetResultAsShortInt</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsSmallInt">SetResultAsSmallInt</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsInteger">SetResultAsInteger</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsBoolean">SetResultAsBoolean</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsWordBool">SetResultAsWordBool</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsLongBool">SetResultAsLongBool</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsChar">SetResultAsChar</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsWideChar">SetResultAsWideChar</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsDouble">SetResultAsDouble</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsSingle">SetResultAsSingle</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsExtended">SetResultAsExtended</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsCurrency">SetResultAsCurrency</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsAnsiString">SetResultAsAnsiString</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsWideString">SetResultAsWideString</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsShortString">SetResultAsShortString</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsPChar">SetResultAsPChar</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsPWideChar">SetResultAsPWideChar</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsPointer">SetResultAsPointer</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsArray">SetResultAsArray</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsDynArray">SetResultAsDynArray</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsRecord">SetResultAsRecord</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsObject">SetResultAsObject</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsClassRef">SetResultAsClassRef</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsInterface">SetResultAsInterface</a></li>
|
|
<li><a href="#TPaxInvoke.SetResultAsInt64">SetResultAsInt64</a></li>
|
|
<li><a href="#TPaxInvoke.CallHost">CallHost</a></li>
|
|
<li><a href="#TPaxInvoke.GetResultPtr">GetResultPtr</a></li>
|
|
<li><a href="#TPaxInvoke.ClearResult">ClearResult</a></li>
|
|
</ul>
|
|
<a name="TPaxInvoke.Create"><h3>TPaxInvoke.Create</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Constructor of TPaxInvoke class.
|
|
<pre>
|
|
<font color="blue"><b>constructor</b></font> Create(AOwner: TComponent); <font color="blue"><b>override</b></font>;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.Destroy"><h3>TPaxInvoke.Destroy</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Destructor of TPaxInvoke class.
|
|
<pre>
|
|
<font color="blue"><b>destructor</b></font> Destroy; <font color="blue"><b>override</b></font>;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.LoadAddress"><h3>TPaxInvoke.LoadAddress</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Loads dll and assigns address of a dll-defind functions to Address property.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> LoadAddress(<font color="blue"><b>const</b></font> DllName, ProcName: <font color="blue"><b>String</b></font>);
|
|
</pre>
|
|
<p>
|
|
<H4>
|
|
Example
|
|
</H4>
|
|
<pre>
|
|
PaxInvoke1.This := <font color="blue"><b>nil</b></font>;
|
|
PaxInvoke1.CallConv := _ccMSFASTCALL;
|
|
PaxInvoke1.LoadAddress(<font color="Red">'CppDll.dll'</font>, <font color="Red">'cube'</font>);
|
|
PaxInvoke1.ClearArguments;
|
|
PaxInvoke1.AddArgAsInteger(2);
|
|
PaxInvoke1.SetResultAsInteger;
|
|
PaxInvoke1.CallHost;
|
|
ShowMessage(IntToStr(Integer(PaxInvoke1.GetResultPtr^)));
|
|
</pre>
|
|
</p>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.ClearArguments"><h3>TPaxInvoke.ClearArguments</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Clears arguments.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> ClearArguments;
|
|
</pre>
|
|
<p>
|
|
<H4>
|
|
Example
|
|
</H4>
|
|
<pre>
|
|
<font color="blue"><b>function</b></font> TForm1.Test(X, Y: Integer): Integer; <font color="blue"><b>stdcall</b></font>;
|
|
<font color="blue"><b>begin</b></font>
|
|
result := X + Y;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>procedure</b></font> TForm1.Button7Click(Sender: TObject);
|
|
|
|
<font color="blue"><b>function</b></font> P(X, Y: Currency): <font color="blue"><b>String</b></font>; <font color="blue"><b>stdcall</b></font>;
|
|
<font color="blue"><b>begin</b></font>
|
|
result := CurrToStr(X + Y);
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>begin</b></font>
|
|
PaxInvoke1.This := <font color="blue"><b>nil</b></font>; // this is not a method
|
|
PaxInvoke1.CallConv := _ccSTDCALL;
|
|
PaxInvoke1.Address := @P;
|
|
PaxInvoke1.ClearArguments;
|
|
PaxInvoke1.AddArgAsCurrency(2.2);
|
|
PaxInvoke1.AddArgAsCurrency(3.4);
|
|
PaxInvoke1.SetResultAsAnsiString;
|
|
PaxInvoke1.CallHost; // call host-defined function
|
|
ShowMessage(<font color="blue"><b>String</b></font>(PaxInvoke1.GetResultPtr^));
|
|
PaxInvoke1.ClearResult;
|
|
|
|
PaxInvoke1.This := Self; // this is a method
|
|
PaxInvoke1.CallConv := _ccSTDCALL;
|
|
PaxInvoke1.Address := @TForm1.Test;
|
|
PaxInvoke1.ClearArguments;
|
|
PaxInvoke1.AddArgAsInteger(2);
|
|
PaxInvoke1.AddArgAsInteger(3);
|
|
PaxInvoke1.SetResultAsInteger;
|
|
PaxInvoke1.CallHost;
|
|
ShowMessage(IntToStr(Integer(PaxInvoke1.GetResultPtr^)));
|
|
<font color="blue"><b>end</b></font>;
|
|
</pre>
|
|
</p>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsByte"><h3>TPaxInvoke.AddArgAsByte</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Byte type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsByte(value: Byte);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsWord"><h3>TPaxInvoke.AddArgAsWord</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Word type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsWord(value: Word);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsCardinal"><h3>TPaxInvoke.AddArgAsCardinal</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Cardinal type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsCardinal(value: Cardinal);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsShortInt"><h3>TPaxInvoke.AddArgAsShortInt</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of ShortInt type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsShortInt(value: ShortInt);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsSmallInt"><h3>TPaxInvoke.AddArgAsSmallInt</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of SmallInt type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsSmallInt(value: SmallInt);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsInteger"><h3>TPaxInvoke.AddArgAsInteger</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Integer type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsInteger(value: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsInt64"><h3>TPaxInvoke.AddArgAsInt64</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Int64 type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsInt64(value: Int64);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsLongBool"><h3>TPaxInvoke.AddArgAsLongBool</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of LongBool type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsLongBool(value: LongBool);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsWordBool"><h3>TPaxInvoke.AddArgAsWordBool</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of WordBool type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsWordBool(value: WordBool);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsBoolean"><h3>TPaxInvoke.AddArgAsBoolean</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Boolean type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsBoolean(value: Boolean);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsChar"><h3>TPaxInvoke.AddArgAsChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Char type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsChar(value: Char);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsWideChar"><h3>TPaxInvoke.AddArgAsWideChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of WideChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsWideChar(value: WideChar);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsDouble"><h3>TPaxInvoke.AddArgAsDouble</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Double type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsDouble(value: Double);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsSingle"><h3>TPaxInvoke.AddArgAsSingle</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Single type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsSingle(value: Single);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsExtended"><h3>TPaxInvoke.AddArgAsExtended</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Extended type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsExtended(value: Extended);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsCurrency"><h3>TPaxInvoke.AddArgAsCurrency</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Currency type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsCurrency(value: Currency);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsAnsiString"><h3>TPaxInvoke.AddArgAsAnsiString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of AnsiString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsAnsiString(<font color="blue"><b>const</b></font> value: AnsiString);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsWideString"><h3>TPaxInvoke.AddArgAsWideString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of WideString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsWideString(<font color="blue"><b>const</b></font> value: WideString);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsShortString"><h3>TPaxInvoke.AddArgAsShortString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of ShortString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsShortString(<font color="blue"><b>const</b></font> value: ShortString);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsPChar"><h3>TPaxInvoke.AddArgAsPChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of PChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsPChar(value: PChar);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsPWideChar"><h3>TPaxInvoke.AddArgAsPWideChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of PWideChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsPWideChar(value: PWideChar);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsPointer"><h3>TPaxInvoke.AddArgAsPointer</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Pointer type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsPointer(value: Pointer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsRecord"><h3>TPaxInvoke.AddArgAsRecord</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a Record type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsRecord(<font color="blue"><b>var</b></font> value; Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsRecordByVal"><h3>TPaxInvoke.AddArgAsRecordByVal</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a record type. Argument is passed by value.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsRecordByVal(<font color="blue"><b>var</b></font> value; Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsArray"><h3>TPaxInvoke.AddArgAsArray</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of array type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsArray(<font color="blue"><b>var</b></font> value; Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsArrayByVal"><h3>TPaxInvoke.AddArgAsArrayByVal</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of array type. Argument is passed by value.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsArrayByVal(<font color="blue"><b>var</b></font> value; Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsDynArray"><h3>TPaxInvoke.AddArgAsDynArray</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a dynamic array type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsDynArray(<font color="blue"><b>var</b></font> value);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsObject"><h3>TPaxInvoke.AddArgAsObject</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a class type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsObject(value: TObject);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsClassRef"><h3>TPaxInvoke.AddArgAsClassRef</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a class reference type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsClassRef(value: TClass);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsVariant"><h3>TPaxInvoke.AddArgAsVariant</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of Variant type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsVariant(<font color="blue"><b>const</b></font> value: Variant);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsSet"><h3>TPaxInvoke.AddArgAsSet</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of a set type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsSet(<font color="blue"><b>var</b></font> value; Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.AddArgAsInterface"><h3>TPaxInvoke.AddArgAsInterface</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Adds argument of an interface type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> AddArgAsInterface(<font color="blue"><b>const</b></font> value: IUnknown);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsVoid"><h3>TPaxInvoke.SetResultAsVoid</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as void type (for procedures).
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsVoid;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsByte"><h3>TPaxInvoke.SetResultAsByte</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Byte type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsByte;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsWord"><h3>TPaxInvoke.SetResultAsWord</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Word type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsWord;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsCardinal"><h3>TPaxInvoke.SetResultAsCardinal</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Cardinal type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsCardinal;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsShortInt"><h3>TPaxInvoke.SetResultAsShortInt</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as ShortInt type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsShortInt;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsSmallInt"><h3>TPaxInvoke.SetResultAsSmallInt</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as SmallInt type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsSmallInt;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsInteger"><h3>TPaxInvoke.SetResultAsInteger</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Integer type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsInteger;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsBoolean"><h3>TPaxInvoke.SetResultAsBoolean</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Boolean type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsBoolean;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsWordBool"><h3>TPaxInvoke.SetResultAsWordBool</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as WordBool type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsWordBool;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsLongBool"><h3>TPaxInvoke.SetResultAsLongBool</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as LongBool type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsLongBool;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsChar"><h3>TPaxInvoke.SetResultAsChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Char type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsChar;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsWideChar"><h3>TPaxInvoke.SetResultAsWideChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as WideChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsWideChar;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsDouble"><h3>TPaxInvoke.SetResultAsDouble</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Double type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsDouble;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsSingle"><h3>TPaxInvoke.SetResultAsSingle</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Single type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsSingle;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsExtended"><h3>TPaxInvoke.SetResultAsExtended</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Extended type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsExtended;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsCurrency"><h3>TPaxInvoke.SetResultAsCurrency</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Currency type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsCurrency;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsAnsiString"><h3>TPaxInvoke.SetResultAsAnsiString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as AnsiString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsAnsiString;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsWideString"><h3>TPaxInvoke.SetResultAsWideString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as WideString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsWideString;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsShortString"><h3>TPaxInvoke.SetResultAsShortString</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as ShortString type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsShortString;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsPChar"><h3>TPaxInvoke.SetResultAsPChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as PChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsPChar;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsPWideChar"><h3>TPaxInvoke.SetResultAsPWideChar</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as PWideChar type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsPWideChar;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsPointer"><h3>TPaxInvoke.SetResultAsPointer</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as a pointer type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsPointer;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsArray"><h3>TPaxInvoke.SetResultAsArray</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as an array type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsArray(Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsDynArray"><h3>TPaxInvoke.SetResultAsDynArray</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as a dynamic array type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsDynArray;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsRecord"><h3>TPaxInvoke.SetResultAsRecord</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as a record type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsRecord(Size: Integer);
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsObject"><h3>TPaxInvoke.SetResultAsObject</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as a class type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsObject;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsClassRef"><h3>TPaxInvoke.SetResultAsClassRef</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as a class reference type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsClassRef;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsInterface"><h3>TPaxInvoke.SetResultAsInterface</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as an interface type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsInterface;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.SetResultAsInt64"><h3>TPaxInvoke.SetResultAsInt64</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Sets result type as Int64 type.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> SetResultAsInt64;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.CallHost"><h3>TPaxInvoke.CallHost</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Calls a host-defined function or method.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> CallHost;
|
|
</pre>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.GetResultPtr"><h3>TPaxInvoke.GetResultPtr</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
Returns pointer to a result value.
|
|
<pre>
|
|
<font color="blue"><b>function</b></font> GetResultPtr: Pointer;
|
|
</pre>
|
|
<p>
|
|
You have to apply the type cast to extract a result value.
|
|
<H4>
|
|
Example
|
|
</H4>
|
|
<pre>
|
|
<font color="blue"><b>type</b></font>
|
|
TCharRec = <font color="blue"><b>record</b></font>
|
|
X, Y: Char;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>function</b></font> MyHostFunc(<font color="blue"><b>const</b></font> U, V: TCharRec): <font color="blue"><b>String</b></font>; <font color="blue"><b>stdcall</b></font>;
|
|
<font color="blue"><b>begin</b></font>
|
|
result := U.X + V.Y;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>var</b></font>
|
|
R: TCharRec;
|
|
S: <font color="blue"><b>String</b></font>;
|
|
<font color="blue"><b>begin</b></font>
|
|
R.X := <font color="Red">'a'</font>;
|
|
R.Y := <font color="Red">'b'</font>;
|
|
|
|
PaxInvoke1.Address := @ MyHostFunc;
|
|
PaxInvoke1.This := <font color="blue"><b>nil</b></font>; // this is not a method, but global function
|
|
PaxInvoke1.ClearArguments;
|
|
PaxInvoke1.AddArgAsRecord(R, SizeOf(R));
|
|
PaxInvoke1.AddArgAsRecord(R, SizeOf(R));
|
|
PaxInvoke1.SetResultAsAnsiString;
|
|
PaxInvoke1.CallConv := _ccSTDCALL;
|
|
PaxInvoke1.CallHost; // call host-defined function
|
|
S := <font color="blue"><b>String</b></font>(PaxInvoke1.GetResultPtr^);
|
|
ShowMessage(S);
|
|
</pre>
|
|
</p>
|
|
</blockquote>
|
|
<a name="TPaxInvoke.ClearResult"><h3>TPaxInvoke.ClearResult</h3></a>
|
|
<!-------------------------------------------------------------------->
|
|
<blockquote>
|
|
If result type is a dynamic type such as AnsiString, Interface, Variant or dynamic array, you have to apply the ClearResult method to avoid a memory leak.
|
|
<pre>
|
|
<font color="blue"><b>procedure</b></font> ClearResult;
|
|
</pre>
|
|
<p>
|
|
<H4>
|
|
Example
|
|
</H4>
|
|
<pre>
|
|
<font color="blue"><b>type</b></font>
|
|
ITest = <font color="blue"><b>interface</b></font>
|
|
[<font color="Red">'{E7AA427A-0F4D-4A96-A914-FAB1CA336337}'</font>]
|
|
<font color="blue"><b>procedure</b></font> Proc(<font color="blue"><b>const</b></font> S: <font color="blue"><b>String</b></font>);
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
TTest = <font color="blue"><b>class</b></font>(TInterfacedObject, ITest)
|
|
<font color="blue"><b>public</b></font>
|
|
<font color="blue"><b>procedure</b></font> Proc(<font color="blue"><b>const</b></font> S: <font color="blue"><b>String</b></font>);
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>procedure</b></font> TTest.Proc(<font color="blue"><b>const</b></font> S: <font color="blue"><b>String</b></font>);
|
|
<font color="blue"><b>begin</b></font>
|
|
ShowMessage(S);
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>function</b></font> GetIntf(I: ITest): ITest;
|
|
<font color="blue"><b>begin</b></font>
|
|
<font color="blue"><b>if</b></font> Assigned(I) <font color="blue"><b>then</b></font>
|
|
result := I
|
|
<font color="blue"><b>else</b></font>
|
|
result := TTest.Create;
|
|
<font color="blue"><b>end</b></font>;
|
|
|
|
<font color="blue"><b>var</b></font>
|
|
I, J: ITest;
|
|
<font color="blue"><b>begin</b></font>
|
|
J := TTest.Create;
|
|
|
|
PaxInvoke1.This := <font color="blue"><b>nil</b></font>; // this is not a method
|
|
PaxInvoke1.CallConv := _ccREGISTER;
|
|
PaxInvoke1.Address := @GetIntf;
|
|
PaxInvoke1.ClearArguments;
|
|
PaxInvoke1.AddArgAsInterface(J);
|
|
PaxInvoke1.SetResultAsInterface;
|
|
PaxInvoke1.CallHost; // call host-defined function
|
|
IUnknown(I) := IUnknown(PaxInvoke1.GetResultPtr^);
|
|
I.Proc(<font color="Red">'hello'</font>);
|
|
|
|
PaxInvoke1.ClearResult; // IUnknown(PaxInvoke1.GetResultPtr^)._Release;
|
|
<font color="blue"><b>end</b></font>;
|
|
</pre>
|
|
</p>
|
|
</blockquote>
|
|
<p>
|
|
<HR>
|
|
<font size = 1 color ="gray">
|
|
Copyright © 2006-2009
|
|
VIRT Laboratory. All rights reserved.
|
|
</font>
|
|
</body>
|
|
</html>
|