COM 和 .Net(Windows)
简介
COM 是 Component Object Model 的缩写;它是 DCE
RPC(公开标准)之上的面向对象层(和相关服务),定义了通用的调用转换,任一语言编写的代码都可以与另外的任一语言(前提是这些语言可以
COM 感知)编写的代码进行互相调用与交互。代码不仅可以用任何语言编写,并且不需要是同一个执行文件的一部分;代码可以从 DLL
载入,或者从相同机器的另外一个进程中找到,或者使用 DCOM(分布式 COM),或者从远程机器的另外一个进程中找到,所有的这些都不要代码知道组件在哪里。
有个 COM 子集叫做 OLE 自动化,包含一组允许松散绑定 COM 对象的 COM
接口,因此可以在运行是对其自省(introspected)和调用,而无需了解编译时这些对象的工作原理。PHP
COM 扩展利用 OLE 自动化接口,允许从脚本中创建和调用兼容对象。从技术上,这应该称为“OLE Automation
Extension for PHP”(PHP OLE 自动化扩展),因为并非所有的 COM 对象用于 OLE 兼容。
现在,为什么以及何时应该使用 COM?COM 是在 Windows 平台上将组件和应用结合在一起的主要方法之一;使用 COM 可以启动 Microsoft Word,填充文档模板并将结果保存为 Word 文档,然后将其发送给网站的访客。可以使用 COM 为网络执行管理任务和配置 IIS;这些只是最常见的用途;还可以使用 COM 做更多的事情。
此外,支持使用 Microsoft 提供的 COM 互操作层来实例化和创建 .NET 程序集。
- 安装/配置
- 预定义常量
- Errors and error handling
- 示例
- com — The com class
- com::__construct — com class constructor
- dotnet — The dotnet class
- dotnet::__construct — dotnet class constructor
- variant — variant class
- variant::__construct — variant class constructor
- COMPersistHelper — The COMPersistHelper class
- COMPersistHelper::__construct — Construct a COMPersistHelper object
- COMPersistHelper::GetCurFileName — Get current filename
- COMPersistHelper::GetMaxStreamSize — Get maximum stream size
- COMPersistHelper::InitNew — Initialize object to default state
- COMPersistHelper::LoadFromFile — Load object from file
- COMPersistHelper::LoadFromStream — Load object from stream
- COMPersistHelper::SaveToFile — Save object to file
- COMPersistHelper::SaveToStream — Save object to stream
- com_exception — The com_exception class
- com_safearray_proxy — com_safearray_proxy 类
- COM 函数
- com_create_guid — Generate a globally unique identifier (GUID)
- com_event_sink — Connect events from a COM object to a PHP object
- com_get_active_object — Returns a handle to an already running instance of a COM object
- com_load_typelib — 载入 Typelib
- com_message_pump — Process COM messages, sleeping for up to timeoutms milliseconds
- com_print_typeinfo — Print out a PHP class definition for a dispatchable interface
- variant_abs — Returns the absolute value of a variant
- variant_add — "Adds" two variant values together and returns the result
- variant_and — Performs a bitwise AND operation between two variants
- variant_cast — Convert a variant into a new variant object of another type
- variant_cat — Concatenates two variant values together and returns the result
- variant_cmp — Compares two variants
- variant_date_from_timestamp — Returns a variant date representation of a Unix timestamp
- variant_date_to_timestamp — Converts a variant date/time value to Unix timestamp
- variant_div — Returns the result from dividing two variants
- variant_eqv — Performs a bitwise equivalence on two variants
- variant_fix — Returns the integer portion of a variant
- variant_get_type — Returns the type of a variant object
- variant_idiv — Converts variants to integers and then returns the result from dividing them
- variant_imp — Performs a bitwise implication on two variants
- variant_int — Returns the integer portion of a variant
- variant_mod — Divides two variants and returns only the remainder
- variant_mul — Multiplies the values of the two variants
- variant_neg — Performs logical negation on a variant
- variant_not — Performs bitwise not negation on a variant
- variant_or — Performs a logical disjunction on two variants
- variant_pow — Returns the result of performing the power function with two variants
- variant_round — Rounds a variant to the specified number of decimal places
- variant_set — Assigns a new value for a variant object
- variant_set_type — Convert a variant into another type "in-place"
- variant_sub — Subtracts the value of the right variant from the left variant value
- variant_xor — Performs a logical exclusion on two variants
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
