mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-28 14:58:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61864 c90b9560-bf6c-de11-be94-00142212c4b1
456 lines
13 KiB
XML
456 lines
13 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.22 $ -->
|
|
<reference id="ref.com">
|
|
<title>COM support functions for Windows</title>
|
|
<titleabbrev>COM</titleabbrev>
|
|
|
|
<partintro>
|
|
<simpara>
|
|
COM functions are only available on the Windows version of
|
|
PHP. These functions have been added in PHP 4.
|
|
</simpara>
|
|
</partintro>
|
|
|
|
<refentry id="class.com">
|
|
<refnamediv>
|
|
<refname>COM</refname>
|
|
<refpurpose>COM class</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv>
|
|
<synopsis>$obj = new <classname>COM</classname>("server.object")</synopsis>
|
|
</refsynopsisdiv>
|
|
<refsect1 id="class.com.class">
|
|
<title>Description</title>
|
|
<simpara>
|
|
The COM class provides a framework to integrate (D)COM components into
|
|
your php scripts.
|
|
</simpara>
|
|
</refsect1>
|
|
<refsect1 id="class.com.constructor">
|
|
<title>Methods</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>string <function>COM::COM</function></funcdef>
|
|
<paramdef>string <parameter>module_name</parameter></paramdef>
|
|
<paramdef>string <parameter><optional>server_name</optional></parameter></paramdef>
|
|
<paramdef>int <parameter><optional>codepage</optional></parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
COM class constructor. Parameters:
|
|
<variablelist>
|
|
<varlistentry><term>module_name</term>
|
|
<listitem>
|
|
<simpara>
|
|
name or class-id of the requested component.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>server_name</term>
|
|
<listitem>
|
|
<simpara>
|
|
name of the DCOM server from which the component should be fetched.
|
|
If &null;, <literal>localhost</literal> is assumed.
|
|
To allow DCOM <constant>com.allow_dcom</constant> has to be set to
|
|
&true; in <filename>php.ini</filename>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>codepage</term>
|
|
<listitem>
|
|
<simpara>
|
|
specifies the codepage that is used to convert php-strings to
|
|
unicode-strings and vice versa. Possible values are
|
|
<constant>CP_ACP</constant>, <constant>CP_MACCP</constant>,
|
|
<constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>,
|
|
<constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant>
|
|
and <constant>CP_UTF8</constant>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
<para>
|
|
<example id="example.com1">
|
|
<title>COM example (1)</title>
|
|
<programlisting role="php">
|
|
// starting word
|
|
$word = new COM("word.application") or die("Unable to instanciate Word");
|
|
print "Loaded Word, version {$word->Version}\n";
|
|
|
|
//bring it to front
|
|
$word->Visible = 1;
|
|
|
|
//open an empty document
|
|
$word->Documents->Add();
|
|
|
|
//do some weird stuff
|
|
$word->Selection->TypeText("This is a test...");
|
|
$word->Documents[1]->SaveAs("Useless test.doc");
|
|
|
|
//closing word
|
|
$word->Quit();
|
|
|
|
//free the object
|
|
$word->Release();
|
|
$word = null;
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example id="example.com2">
|
|
<title>COM example (2)</title>
|
|
<programlisting role="php">
|
|
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
|
|
$conn->Open("Provider=SQLOLEDB; Data Source=localhost;
|
|
Initial Catalog=database; User ID=user; Password=password");
|
|
|
|
$rs = $conn->Execute("SELECT * FROM sometable"); // Recordset
|
|
|
|
$num_columns = $rs->Fields->Count();
|
|
echo $num_columns . "\n";
|
|
|
|
for ($i=0; $i < $num_columns; $i++)
|
|
{
|
|
$fld[$i] = $rs->Fields($i);
|
|
}
|
|
|
|
$rowcount = 0;
|
|
while (!$rs->EOF)
|
|
{
|
|
for ($i=0; $i < $num_columns; $i++)
|
|
{
|
|
echo $fld[$i]->value . "\t";
|
|
}
|
|
echo "\n";
|
|
$rowcount++; // increments rowcount
|
|
$rs->MoveNext();
|
|
}
|
|
|
|
$rs->Close();
|
|
$conn->Close();
|
|
|
|
$rs->Release();
|
|
$conn->Release();
|
|
|
|
$rs = null;
|
|
$conn = null;
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="class.variant">
|
|
<refnamediv>
|
|
<refname>VARIANT</refname>
|
|
<refpurpose>VARIANT class</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv>
|
|
<synopsis>$vVar = new <classname>VARIANT</classname>($var)</synopsis>
|
|
</refsynopsisdiv>
|
|
<refsect1 id="class.variant.class">
|
|
<title>Description</title>
|
|
<simpara>
|
|
A simple container to wrap variables into VARIANT structures.
|
|
</simpara>
|
|
</refsect1>
|
|
<refsect1 id="class.variant.constructor">
|
|
<title>Methods</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>string <function>VARIANT::VARIANT</function></funcdef>
|
|
<paramdef>mixed <parameter><optional>value</optional></parameter></paramdef>
|
|
<paramdef>int <parameter><optional>type</optional></parameter></paramdef>
|
|
<paramdef>int <parameter><optional>codepage</optional></parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
VARIANT class constructor. Parameters:
|
|
<variablelist>
|
|
<varlistentry><term>value</term>
|
|
<listitem>
|
|
<simpara>
|
|
initial value. if omitted an VT_EMPTY object is created.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>type</term>
|
|
<listitem>
|
|
<simpara>
|
|
specifies the content type of the VARIANT object. Possible values are
|
|
<constant>VT_UI1</constant>, <constant>VT_UI2</constant>, <constant>VT_UI4</constant>,
|
|
<constant>VT_I1</constant>, <constant>VT_I2</constant>, <constant>VT_I4</constant>,
|
|
<constant>VT_R4</constant>, <constant>VT_R8</constant>, <constant>VT_INT</constant>, <constant>VT_UINT</constant>,
|
|
<constant>VT_BOOL</constant>, <constant>VT_ERROR</constant>, <constant>VT_CY</constant>,
|
|
<constant>VT_DATE</constant>, <constant>VT_BSTR</constant>, <constant>VT_DECIMAL</constant>,
|
|
<constant>VT_UNKNOWN</constant>, <constant>VT_DISPATCH</constant> and <constant>VT_VARIANT</constant>. These values are
|
|
mutual exclusive, but they can be combined with <constant>VT_BYREF</constant> to specify beeing a value. If omitted,
|
|
the type of <parameter>value</parameter> is used. Consult the msdn library for additional information.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry><term>codepage</term>
|
|
<listitem>
|
|
<simpara>
|
|
specifies the codepage that is used to convert php-strings to
|
|
unicode-strings and vice versa. Possible values are
|
|
<constant>CP_ACP</constant>, <constant>CP_MACCP</constant>,
|
|
<constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>,
|
|
<constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant>
|
|
and <constant>CP_UTF8</constant>.
|
|
</simpara>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-load">
|
|
<refnamediv>
|
|
<refname>com_load</refname>
|
|
<refpurpose>
|
|
Creates a new reference to a COM component
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>string <function>com_load</function></funcdef>
|
|
<paramdef>string <parameter>module name</parameter></paramdef>
|
|
<paramdef>string
|
|
<parameter>
|
|
<optional>server name</optional>
|
|
</parameter>
|
|
</paramdef>
|
|
<paramdef>int
|
|
<parameter>
|
|
<optional>codepage</optional>
|
|
</parameter>
|
|
</paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
<function>com_load</function> creates a new COM component and
|
|
returns a reference to it. Returns &false; on
|
|
failiure.Possible values for <parameter>codepage</parameter> are
|
|
<constant>CP_ACP</constant>, <constant>CP_MACCP</constant>,
|
|
<constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>,
|
|
<constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant>
|
|
and <constant>CP_UTF8</constant>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-invoke">
|
|
<refnamediv>
|
|
<refname>com_invoke</refname>
|
|
<refpurpose>
|
|
Calls a COM component's method.
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>mixed <function>com_invoke</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>function_name</parameter></paramdef>
|
|
<paramdef>mixed
|
|
<parameter>
|
|
<optional>function parameters, ...</optional>
|
|
</parameter>
|
|
</paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
<function>com_invoke</function> invokes a method of the COM
|
|
component referenced by
|
|
<parameter>com_object</parameter>. Returns
|
|
&false; on error, returns the
|
|
<parameter>function_name</parameter>'s return value on success.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-propget">
|
|
<refnamediv>
|
|
<refname>com_propget</refname>
|
|
<refpurpose>
|
|
Gets the value of a COM Component's property
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>mixed <function>com_propget</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>property</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function is an alias for <function>com_get</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-get">
|
|
<refnamediv>
|
|
<refname>com_get</refname>
|
|
<refpurpose>
|
|
Gets the value of a COM Component's property
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>mixed <function>com_get</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>property</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the value of the <parameter>property</parameter> of the
|
|
COM component referenced by <parameter>com_object</parameter>.
|
|
Returns &false; on error.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-propput">
|
|
<refnamediv>
|
|
<refname>com_propput</refname>
|
|
<refpurpose>
|
|
Assigns a value to a COM component's property
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>com_propput</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>property</parameter></paramdef>
|
|
<paramdef>mixed <parameter>value</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function is an alias for <function>com_set</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-propset">
|
|
<refnamediv>
|
|
<refname>com_propset</refname>
|
|
<refpurpose>
|
|
Assigns a value to a COM component's property
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>com_propset</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>property</parameter></paramdef>
|
|
<paramdef>mixed <parameter>value</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function is an alias for <function>com_set</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-set">
|
|
<refnamediv>
|
|
<refname>com_set</refname>
|
|
<refpurpose>
|
|
Assigns a value to a COM component's property
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>com_set</function></funcdef>
|
|
<paramdef>resource <parameter>com_object</parameter></paramdef>
|
|
<paramdef>string <parameter>property</parameter></paramdef>
|
|
<paramdef>mixed <parameter>value</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Sets the value of the <parameter>property</parameter> of the COM
|
|
component referenced by <parameter>com_object</parameter>.
|
|
Returns the newly set value if succeeded, &false; on error.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-addref">
|
|
<refnamediv>
|
|
<refname>com_addref</refname>
|
|
<refpurpose>
|
|
Increases the components reference counter.
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>com_addref</function></funcdef>
|
|
<void/>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Increases the components reference counter.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.com-release">
|
|
<refnamediv>
|
|
<refname>com_release</refname>
|
|
<refpurpose>
|
|
Decreases the components reference counter.
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>com_release</function></funcdef>
|
|
<void/>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Decreases the components reference counter.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|