View source: R/autoInterface.S
createCOMSClass | R Documentation |
This generates a simple S class that provides structured access to a
corresponding COM class. This function is used to “compile” COM
classes for S. Using the type information for the COM class, we
generate methods for the $
and $<-
operators which
provide controlled and efficient access to COM objects of this class.
These methods have information about the properties and methods of the
COM class and can detect errors on the client side of the interface
before making calls to the COM server. Additionally, the operators
use the name-identifier mappings from the type information to avoid an
extra round-trip for each .COM
call. Also, the
operators know which elements of the COM class are properties and
which are methods and so one can use the $
operator to access
both types of elements rather than using [[
for properties and
$
for methods.
This defines a new S4 class that is a simple extension of the
COMIDispatch-class
class in the
RDCOMClient
package. The new class is used primarily to
support methods that know the specific details of the COM class.
Objects of this new class can be created manually or implicitly in the
RDCOMClient
conversion mechanism that creates COM objects from
C++ IDispatch objects. In the latter case, the
createCOMReference
function must be able to
map the UUID of the COM object to an S4 class name that extends
COMIDispatch-class
.
This createCOMSClass
function writes this information into
the global character vector .COMSClassMap
.
createCOMSClass(libEntry, className, where = NULL)
libEntry |
the |
className |
the name to use for the new S class that is created |
where |
unused at present. |
The name of the new S4 class.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
http://msdn.microsoft.com/library http://www.omegahat.org/SWinTypeLibs
computeFunctionInformation
generateOperators
getTypeInfo
LoadTypeLib
createCOMReference
## Not run:
lib = LoadTypeLib("C:\\Program Files\\Microsoft Office\\Office\\EXCEL9.OLB")
createCOMSClass(lib[["_Application"]], "ExcelApplication")
library(RDCOMClient)
e = COMCreate("Excel.Application")
e = as(e, "ExcelApplication")
e$Visible
e$Visible = TRUE
e$Workbooks$Add()
e$CheckSpelling("Is this okey?")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.