Difference between revisions of "Zh/Documentation/DevGuide/ProUNO/Bridge/Using UNO from Automation"

From Apache OpenOffice Wiki
Jump to: navigation, search
(New page: {{Documentation/DevGuide/ProUNOTOC/Zh |ProUNO2c=block |ABridgeSvcMgr=block |UNOAuto=block |ShowPrevNext=block |PrevPage=Zh/Documentation/DevGuide/ProUNO/Bridge/The Service Manager Componen...)
 
 
Line 7: Line 7:
 
|NextPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Calling Functions and Accessing Properties
 
|NextPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Calling Functions and Accessing Properties
 
}}
 
}}
[[en:Documentation/DevGuide/ProUNO/Bridge/Using UNO from Automation]]
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Bridge/{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:从 Automation 使用 UNO}}
 
{{DISPLAYTITLE:从 Automation 使用 UNO}}
  

Latest revision as of 02:58, 14 May 2009



有了 IDL 说明和文档后,就可以开始编写使用接口的代码。这需要了解有关编程语言的知识,尤其是如何用该语言访问 UNO 接口以及如何调用函数。


在某些语言(如 C++)中,接口及其函数的用法非常简单,因为 IDL 说明与各个 C++ 对应部分之间的映射恰如其分。例如,函数的语法相似,而且还可以实现接口和 out 参数。C++ 语言不是 Automation 的最佳选择,因为所有接口调用都必须使用 IDispatch,而在 C++ 中使用 <coded>IDispatch</code> 比较困难。在其他语言(如 VB 和 Jscript)中,IDispatch 接口隐藏在对象语法背后,这使得代码更短且更易于理解。


不同接口可以拥有相同名称的函数。无法调用属于特定接口的函数,因为无法在 Automation 中请求接口。如果某个 UNO 对象提供的两个函数具有相同的名称,就不能确定将调用哪个函数。将来计划提供此问题的解决方案。


并非所有语言处理方法参数的方式都是相同的,尤其是输入参数同时作为输出参数重复使用时。从 VB 程序员的角度来看,out 参数与 in 参数看起来是一样的。但是,要在 Jscript 中实现 out 参数,请使用 ArrayValue Object ,它们是 Automation 桥提供的特殊构造。JScript 不支持通过引用调用来实现 out 参数。


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages