From 1ca42ffdcccebae1d9c021729c09892e7e64b262 Mon Sep 17 00:00:00 2001 From: Damien Seguy Date: Mon, 14 May 2001 10:35:28 +0000 Subject: [PATCH] Commiting Harald Radi 's docs. (corrected some bad tag, and removed exta /references. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@47376 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/com.xml | 567 +++++++++++++++++++++++++++++++--------------- 1 file changed, 387 insertions(+), 180 deletions(-) diff --git a/functions/com.xml b/functions/com.xml index 366571cf21..8214c5eb01 100644 --- a/functions/com.xml +++ b/functions/com.xml @@ -1,192 +1,398 @@ - - COM support functions for Windows - COM - - + + COM support functions for Windows + COM + + + + COM functions are only available on the Windows version of + PHP. These functions have been added in PHP 4. + + + + + + COM + COM class + + + $obj = new COM("server.object") + + + Description - These functions are only available on the Windows version of - PHP. These functions have been added in PHP 4. + The COM class provides a framework to integrate (D)COM components into + your php scripts. - + + + Properties + + + + Methods + + + string COM::COM + string module name + string server name + int codepage + + + + Description + + COM constructor. Parameters: + + module name + + + name or class-id of the requested component. + + + + server name + + + name of the DCOM server from which the component should be fetched. + If NULL, localhost is assumed. To allow DCOM + com.allow_dcom has to be set to true in php.ini. + + + + codepage + + + specifies the codepage that is used to convert php-strings to + unicode-strings and vice versa. Possible values are + CP_ACP, CP_MACCP, + CP_OEMCP, CP_SYMBOL, + CP_THREAD_ACP, CP_UTF7 + and CP_UTF8. + + + + + + + + + string COM::AddRef + + + + Description + + Increases the components reference counter. + + + + + string COM::Release + + + + Description + + Decreases the components reference counter. + + + + + COM example (1) + +// starting word +$word = new COM("word.application") or die("Unable to instanciate Word"); +print "Loaded Word, version {$word->Version}\n"; - - - com_load - - Creates a new reference to a COM component - - - - Description - - - string com_load - string module name - string - - server name - - - - - - com_load creates a new COM component and - returns a reference to it. Returns false on - failiure. - - - +//bring it to front +$word->Visible = 1; - - - com_invoke - - Calls a COM component's method. - - - - Description - - - mixed com_invoke - resource com_object - string function_name - mixed - - function parameters, ... - - - - - - Com_invoke invokes a method of the COM - component referenced by - com_object. Returns - false on error, returns the - function_name's return value on success. - - - +//open an empty document +$word->Documents->Add(); - - - com_propget - - Gets the value of a COM Component's property - - - - Description - - - mixed com_propget - resource com_object - string property - - - - This function is an alias for com_get. - - - +//do some weird stuff +$word->Selection->TypeText("This is a test..."); +$word->Documents[1]->SaveAs("Useless test.doc"); - - - com_get - - Gets the value of a COM Component's property - - - - Description - - - mixed com_get - resource com_object - string property - - - - Returns the value of the property of the - COM component referenced by com_object. - Returns false on error. - - - +//closing word +$word->Quit(); - - - com_propput - - Assigns a value to a COM component's property - - - - Description - - - void com_propput - resource com_object - string property - mixed value - - - - This function is an alias for com_set. - - - +//free the object +$word->Release(); +$word = null; + + + + + + COM example (2) + +$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"); - - - com_propset - - Assigns a value to a COM component's property - - - - Description - - - void com_propset - resource com_object - string property - mixed value - - - - This function is an alias for com_set. - - - +$rs = $conn->Execute("SELECT * FROM sometable"); // Recordset - - - com_set - - Assigns a value to a COM component's property - - - - Description - - - void com_set - resource com_object - string property - mixed value - - - - Sets the value of the property of the COM - component referenced by com_object. - Returns true if - property is set. Returns - false on error. - - - - +$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; + + + + + + + + + com_load + + Creates a new reference to a COM component + + + + Description + + + string com_load + string module name + string + + server name + + + int + + codepage + + + + + + com_load creates a new COM component and + returns a reference to it. Returns false on + failiure.Possible values for codepage are + CP_ACP, CP_MACCP, + CP_OEMCP, CP_SYMBOL, + CP_THREAD_ACP, CP_UTF7 + and CP_UTF8. + + + + + + + com_invoke + + Calls a COM component's method. + + + + Description + + + mixed com_invoke + resource com_object + string function_name + mixed + + function parameters, ... + + + + + + Com_invoke invokes a method of the COM + component referenced by + com_object. Returns + false on error, returns the + function_name's return value on success. + + + + + + + com_propget + + Gets the value of a COM Component's property + + + + Description + + + mixed com_propget + resource com_object + string property + + + + This function is an alias for com_get. + + + + + + + com_get + + Gets the value of a COM Component's property + + + + Description + + + mixed com_get + resource com_object + string property + + + + Returns the value of the property of the + COM component referenced by com_object. + Returns false on error. + + + + + + + com_propput + + Assigns a value to a COM component's property + + + + Description + + + void com_propput + resource com_object + string property + mixed value + + + + This function is an alias for com_set. + + + + + + + com_propset + + Assigns a value to a COM component's property + + + + Description + + + void com_propset + resource com_object + string property + mixed value + + + + This function is an alias for com_set. + + + + + + + com_set + + Assigns a value to a COM component's property + + + + Description + + + void com_set + resource com_object + string property + mixed value + + + + Sets the value of the property of the COM + component referenced by com_object. + Returns true if + property is set. Returns + false on error. + + + + + + + com_addref + + Increases the components reference counter. + + + + Description + + + void com_addref + + + + Increases the components reference counter. + + + + + + + com_addref + + Decreases the components reference counter. + + + + Description + + + void com_release + + + + Decreases the components reference counter. + + + + +