Title: | R-DCOM client |
---|---|
Description: | Provides dynamic client-side access to (D)COM applications from within R. |
Authors: | Duncan Temple Lang <[email protected]> |
Maintainer: | Duncan Temple Lang <[email protected]> |
License: | GPL2 |
Version: | 0.95-1 |
Built: | 2024-11-01 11:15:12 UTC |
Source: | https://github.com/rickhelmus/RDCOMClient |
This is the S function that provides full access to the C routines that perform the invocation of methods in COM servers. This allows one to control the specification of the dispatch method, whether the result is returned.
.COM(obj, name, ..., .dispatch = as.integer(3), .return = TRUE, .ids = numeric(0), .suppliedArgs)
.COM(obj, name, ..., .dispatch = as.integer(3), .return = TRUE, .ids = numeric(0), .suppliedArgs)
obj |
the COM object reference, usually obtained via
|
name |
the name of the method or property to be accessed. |
... |
arguments to be passed to the method. If names are provided for these arguments, these are used as the names in the COM call. (Not yet!) |
.dispatch |
one or more of the |
.return |
a logical value indicating whether to bother returning the result of the call. This can be used to discard the result of the invocation when only the side-effect is of interest. |
.ids |
an optional numeric vector which, if given,
provides the |
.suppliedArgs |
a logical vector indicating which of the
arguments provided by ... are to be used. In general, this argument
is not used in interactive use. However, when the code calling the |
An arbitrary value obtained from converting the value returned from the COM invocation.
We have madee PROPERTYGET|METHOD the default for method invocation. In this case, this function would become less commonly used.
Also, we will add code to handle the DispatchMethods enumeration symbollically in the same we have for Gtk enumerations in RGtk.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
COMCreate
COMAccessors
getNameIDs
e <- COMCreate("Excel.Application") books <- e[["Workbooks"]] books$Add() # Now for the example! books$Item(1) sheets <- e[["Sheets"]] sheets$Item(1) ## Not run: # We can index the list of sheets by sheet name. # This is not run here as the name is different for # different languages. sheets$Item("Sheet1") ## End(Not run) # Now tidy up. e$Quit() rm(list = c("books", "e", "sheets")) gc() ## Not run: o = COMCreate("Excel.Application") .COM(o, "Count", .dispatch = 2, .ids = id) ## End(Not run)
e <- COMCreate("Excel.Application") books <- e[["Workbooks"]] books$Add() # Now for the example! books$Item(1) sheets <- e[["Sheets"]] sheets$Item(1) ## Not run: # We can index the list of sheets by sheet name. # This is not run here as the name is different for # different languages. sheets$Item("Sheet1") ## End(Not run) # Now tidy up. e$Quit() rm(list = c("books", "e", "sheets")) gc() ## Not run: o = COMCreate("Excel.Application") .COM(o, "Count", .dispatch = 2, .ids = id) ## End(Not run)
This function allows one to turn on and off the COM facilities in an R session. Generally, one calls this at the start of the session and does not turn it off.
.COMInit(status = TRUE)
.COMInit(status = TRUE)
status |
a logical value with |
This merely calls CoInitialize
or CoUninitialize
.
NULL
.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
.COMInit() .COMInit(TRUE) .COMInit(FALSE)
.COMInit() .COMInit(TRUE) .COMInit(FALSE)
This creates a COM array from the contents of a two-dimensional R matrix or data frame. This can be used within R to explicitly coerce an R object before it is passed to the COM mechanism as an argument or return value of a function. Otherwise, the automatic converter mechanism creates a dynamic COM object that points to this S object which loses no information (e.g. column or row names, etc.) This currently only handles basic types in S, i.e. integer, numeric, logical and character elements. In the future, we will provide functions for creating an arbitrary SAFEARRAY and populating it in steps directly from R.
asCOMArray(obj)
asCOMArray(obj)
obj |
an S object that is converted to a matrix and whose resulting contents are copied into the COM array. |
An object which is an external pointer to the newly created SAFEARRAY.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs
## Not run: r = sheet$Range("A1:C10") r[["Value"]] <- asCOMArray(matrix(rnorm(30, 10, 3))) ## End(Not run)
## Not run: r = sheet$Range("A1:C10") r[["Value"]] <- asCOMArray(matrix(rnorm(30, 10, 3))) ## End(Not run)
These operators provide a more S-like
syntax for accessing methods and properties
in a dynamic COM object.
One calls a COM object method using the $
operator.
The values of COM object properties are retrieved and set
using [[
and [[<-
, respectively.
Setting a property returns NULL
.
Invoking a method and getting a property value returns an S object representing the COM value. Primitive COM values are converted to the corresponding S objects. COM objects are returned as COMIDispatch objects.
the COMIDispatch object whose method or property is to be invoked.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
COMList-class
COMTypedList-class
COMTypedNamedList-class
e <- COMCreate("Excel.Application") # Boolean/Logical e[["Visible"]] # Setting a value. e[["Visible"]] <- TRUE # String e[["Path"]] e[["Version"]] # Double e[["Width"]] # Long e[["SheetsInNewWorkbook"]] # Object books <- e[["Workbooks"]] books$Add() # Use this as a container, so can have integer indices, 1-based. books[[1]] e[["Workbooks"]][[1]] ## Not run: books$Open("C:\mySheet.xls") ## End(Not run) e$CheckSpelling("This is a spell check") # okay e$CheckSpelling("This is a spell chck") # error ## Not run: e$SaveWorkspace() ## End(Not run) e$Quit() rm(list= c("e", "books")) gc()
e <- COMCreate("Excel.Application") # Boolean/Logical e[["Visible"]] # Setting a value. e[["Visible"]] <- TRUE # String e[["Path"]] e[["Version"]] # Double e[["Width"]] # Long e[["SheetsInNewWorkbook"]] # Object books <- e[["Workbooks"]] books$Add() # Use this as a container, so can have integer indices, 1-based. books[[1]] e[["Workbooks"]][[1]] ## Not run: books$Open("C:\mySheet.xls") ## End(Not run) e$CheckSpelling("This is a spell check") # okay e$CheckSpelling("This is a spell chck") # error ## Not run: e$SaveWorkspace() ## End(Not run) e$Quit() rm(list= c("e", "books")) gc()
These functions are used from R to either create a COM object of a specific type or to obtain a reference to an existing COM application/object.
COMCreate(name, ..., existing = TRUE) getCOMInstance(guid, force = TRUE, silent = FALSE)
COMCreate(name, ..., existing = TRUE) getCOMInstance(guid, force = TRUE, silent = FALSE)
name |
the name identifying the type of COM object. This is usually the name of the class, such as Excel.Application. In the future, this may support finding class IDs separately and passing them as this argument |
... |
currently ignored. In the future, we will have arguments controlling how the server is created, e.g. the location of the machine, etc. |
guid |
a string (character vector of length 1) that identifies the GUID - Global Unique Identifier - for the COM interface of interest. This should have the curly braces ('...'). |
existing |
a logical value. If this is |
force |
a logical value. If this is |
silent |
a logical value that is used when |
This resolves the class ID given the name and
then creates the instance using CoCreateInstance
.
The class ID is found using CLSIDFromString
and if that fails using CLSIDFromProgID
.
An object of class COMIDispatch
.
getCOMInstance
works with Word and Excel
but for some reason on at least some machines fails
to find an existing Internet Explorer application.
As a result, it will create a new instance of the application.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
The $
and [[
operators
for the COMIDispatch
class - COMAccessors
.
Also, see how one can generate "compiled" or processed interfaces
to any or all of the types in an application using the
SWinTypeLibs
.
## Not run: COMCreate("Excel.Application") getCOMInstance("{000208D5-0000-0000-C000-000000000046}") ## End(Not run)
## Not run: COMCreate("Excel.Application") getCOMInstance("{000208D5-0000-0000-C000-000000000046}") ## End(Not run)
Several types of VARIANTs in COM represent their value as a number which is interpreted appropriately based on the type of the VARIANT. For example, a date is the number of days since January 1, 1900, i.e. Midnight Jan 1, 1900 is 2. Similarly, a date-time value contains the hour, minute and second information in the decimal part of the number. In order to be able to associate the VARIANT type with the value when converting the VARIANT to R, we use these classes which provide the numeric value but also class information corresponding to the VARIANT.
Objects can be created by calls of the form new("COMDate",
...)
,
etc. They are currently created implicitly in the C code that
performs the conversion from VARIANT objects to R.
In the future, we will provide facilities for the reverse direction.
.Data
:Object of class "numeric"
this is the numeric vector in which the value is stored.
Class "numeric"
, from data part.
Class "vector"
, by class "numeric".
No methods defined with class "COMDate" in the signature.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
These classes are used to represent in S an arbitrary
COM object.
IUnknown
is the most basic and provides us with
very little information about the underlying COM object.
COMIDispatch
is the work-horse for this package
and provides a mechanism by which one
can access the methods and properties of the COM object using the IDispatch
interface, i.e. dynamic bindings rather than compiled ones.
COMIDispatch
is a trivial extension of IUnknown
that provides type information which we use to dispatch methods.
The IUnknown
class is merely a reference to the C/C++-level
COM object.
Reference counting is done automatically in the C code so that the COM object should persist as long as there is an S object that refers to it and will be released when no S value refers to it. Of course, other clients can clobber the COM object and the S references will be meaningless.
Objects can be created by calls of the form COMCreate
or implicitly when a COM object is returned from a
COM method call.
ref
:Object of class "externalptr"
this is the C++ value identifying the COM object.
signature(x = "COMIDispatch")
:
accessor for a method in the COM object. This returns
a function that can be used to invoke the named method
See $
in COMAccessors
signature(x = "COMIDispatch", "ANY")
:
generates an error as one cannot assign to a function/method.
This is implemeted this way for symmetry so that
assigning to a property (x[["foo"]] <- 1
)
has the same basic syntax as accessing it
x[["foo"]]
.
If we made this operator a property assignment,
we would have x$foo <- 1
work but x$foo
failing.
See COMAccessors
signature(x = "COMIDispatch", "numeric")
:
access an element of a list via the DCOM object's Item
method,
assuming we it has one.
See COMAccessors
signature(x = "COMIDispatch", "character")
:
set a property value using the specified name.
See COMAccessors
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
This is a function that creates an instance
of a COMList-class
class
or some derived class of this.
The COMList-class
class allows
certain types of COM objects to be treated as
an ordered container with a length, much like
the R list concept.
COMList(obj, class = "COMList")
COMList(obj, class = "COMList")
obj |
the |
class |
the name of the class which is to be instantiated. This argument allows one to use the name of a derived class such as ExcelCOMList or COMTypedList. |
An object of the specified class.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
The COMList type is used in R to represent a COM type which has both a Count() and Item() method. Such a type arises frequentyly in Office applications such as Excel and Word for representing collections or orderd lists of COM objects. For example, Workbooks is a list of Workbook objects, Worksheets is a collection of Worksheet objects, and Addins is a collection of Addin objects. This class provides a way to treat such a container as an R list with methods to compute the length, access elements by index, and iterate over the elements using the s/lapply functions. For each of these, we never convert the list to an R list, but perform the computations via the COM methods.
The COMTypedList-class
class is an extension of COMList
and should be considered a virtual class.
(It is not for implementation reasons only.)
This class has the property that when one extracts individual
elements from the container in R, the class of that
resulting R object is determined from the class of
the COMTypedList. This is done in a very simple fashion
by translating the name of the COMTypedList to its singular
form (in English). So for a COMTypedList of class
Workbooks
, say, the expression x[[1]]
would result in an object of class Workbook
.
It does this computation dynamically. An extension of
the class could compute this value at the time of definition
and use that explicitly. This is an example of the
utility for class slots.
The COMTypedList should be treated as virtual.
One should define an extension of this and the
associated class for the elements in tandem,
e.g. setClass("Workbooks", contains = "COMTypedList")
and setClass("Workbook", contains = "COMIDispatch")
.
The constructor function COMList
should be used to create objects of either of these types.
Alternatively, one can use the canonical form
new("COMList", comObject)
.
ref
:Object of class "externalptr"
. This is
inherited from the base class COMIDispatch-class
.
Class "COMIDispatch"
, directly.
Class "IUnknown"
, by class "COMIDispatch"
.
signature(x = "COMList", i = "numeric")
:
this is the method to access an individual element in the
COM container. This amounts to a call to the method Item
in the COM object.
signature(x = "COMList", i = "numeric")
:
this sets the value of an individual element in the
COM container. In general, this does nothing except
return the COMList
object so that we can
make inline'd assigments of the form
docs[[1]][["Range"]][["Text"]] = "Some text"
and have the docs[[1]]
perform correctly.
signature(X = "COMList")
:
this iterates over the elements of the list
and invokes the specified function with that element
as the first argument. See lapply
signature(X = "COMList")
:
a version of sapply
that we currently need to copy to here.
signature(x = "COMList")
:
computes the number of elements currently in the container.
Duncan Temple Lang <[email protected]>
Excel types. http://www.omegahat.net/RDCOMClient
COMList
.COM
COMTypedList-class
COMTypedNamedList-class
## Not run: e = COMCreate("Excel.Application") e$Workbooks()$Add() e$Workbooks()$Add() l = COMList(e$Workbooks()) length(l) # should be 2 l[[1]] # First Workbook setClass("Workbooks", contains = "COMTypedList") setClass("Workbook", contains = "COMIDispatch") l = COMList(e$Workbooks, "Workbooks") l[[1]] # class is "Workbook" ## End(Not run)
## Not run: e = COMCreate("Excel.Application") e$Workbooks()$Add() e$Workbooks()$Add() l = COMList(e$Workbooks()) length(l) # should be 2 l[[1]] # First Workbook setClass("Workbooks", contains = "COMTypedList") setClass("Workbook", contains = "COMIDispatch") l = COMList(e$Workbooks, "Workbooks") l[[1]] # class is "Workbook" ## End(Not run)
This class is used as a simple extension of
COMIDispatch-class
to illustrate that
it has information about its methods and properties
and can make use of this information in coercing
arguments and return types apporpriately.
This class is used by "compiled" or generated
S code that is derived from reading type libraries
via the SWinTypeLibs
package.
The key things we use this class for are to
provide special methods for
the $
and [[
operators
which can take advantage of the pre-computed
information. The class is "never" used directly
but rather is extended to created derived
classes for particular DCOM interfaces.
Objects of this class are not created directly, but typically are implicitly created by calling methods in the compiled/generated code created from the type library processing.
ref
:Object of class "externalptr"
, inherited from
IUnknown-class
Class "COMIDispatch"
, directly.
Class "IUnknown"
, by class "COMIDispatch"
.
signature(x = "CompiledCOMIDispatch")
:
access a property or call a method.
signature(x = "CompiledCOMIDispatch", name = "character")
: ...
signature(x = "CompiledCOMIDispatch", i = "character")
: ...
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
COMIDispatch-class
generateInterface
writeCode
This is a general function for raising an exception in a DCOM computation from within R. It takes a message and a status code (an integer from the DCOM operation) and raises an error. The class of the error can be specified allowing for different types of errors to be distinguished. It is the ability to specify the class of the error that makes this general.
COMStop(msg, status, class)
COMStop(msg, status, class)
msg |
a message string to display in the error, intended to be human readable. |
status |
an integer that identifies the type of the DCOM error. These are interpreted relative to a table of errors. We should make this available from the R language by accessing the C structures. |
class |
a character vector giving the name of the class(es) for
the error being created.
One can specify different class names to allow error handlers
to easily differentiate between types of errors using
|
This uses the exception mechanism in R to provide extensible error objects that can be caught in a flexible manner.
An error object of the class specified by class
.
Duncan Temple Lang <[email protected]>
http://www.omegahat.net/RDCOMServer http://www.omegahat.net/RDCOMClient
## Not run: COMStop("A fake error message", 1, "FakeCOMError") ## End(Not run)
## Not run: COMStop("A fake error message", 1, "FakeCOMError") ## End(Not run)
These classes extend the basic COMList
.
They are used to represent DCOM types that have methods
that support a list-like interface.
In Office applications, this means that they have methods
named Item
and Count
which correspond to index accessors ([[
)
and length
in R.
We can therefore make these objects feel more
like R lists using methods defined for these classes.
Like COMList-class
, these
classes are not intended to be used directly, but
are to be used in creating derived or sub-classes.
These particular classes provide additional functionality for the
COMList-class
by specifying the type of the elements.
COMTypedList
knows that its elements have a type/class name
given by the singular of its own class. For example, if we had a
class named Workbooks
that extended COMTypedList
, then
elements returned via its Item
method would be coerced to class
Workbook
the singular of Workbooks
.
The class COMTypedNamedList
does essentially
the same thing, but does not rely on the
class name of its elements being the singular form of
its own class name. Instead, the class name is stored
with the COMTypedNamedList
object
and is used to coerce an element returned from
the Item
method to the appropriate R class.
(If we had class slots in the S4 system, we would
use that rather than putting the name into each instance
of a class. However, the overhead is small.)
This is used, for example, in the case of
our Workbooks
illustration above. In Excel,
the Workbooks
type behaves like a list
but returns elements which are of class _Workbook
.
In this case, the name
field in the
derived class Workbooks
would be
_Workbook
and elements would be coerced
to that R type.
These classes form part of the run-time infrastructure
for "compiled" or pre-processed classes to DCOM interfaces
that are generated from the type library describing a collection
of COM interfaces. See the SWinTypeLibs
package
and the generateInterface
function.
Objects can be created from these classes manually using
the familiar new
function. However, when
used in the "compiled" DCOM interfaces, they
are automatically created as return values or
arguments in methods where appropriate.
ref
:Object of class "externalptr"
, inherited
name
:character string (i.e. vector of length 1).
This is the field in the COMTypedNamedList
that specifies the name of the class for an element
of the list.
Class "COMList"
, directly.
Class "COMIDispatch"
, by class "COMList"
.
Class "IUnknown"
, by class "COMList"
.
signature(x = "COMTypedList", i = "ANY")
:
get the i-th element of the DCOM list
and coerce the result to the appropriate type specified by the
type of elements associated with the class.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
This is the function that is called anytime a COM object is being
created or returned from a C language call to S. This function can
examine the object and determine what is the best representation in S
for it. It can use the generic IUnknown
or COMIDispatch
classes to simply represent the pointer value.
Alternatively, it might dynamically generate a new S class
and accessor methods for accessing properties and functions for
that object using the SWinTypeLibs
package. Or it might lookup a previously compiled collection
of type information and match the GUID of the object's type
to find the associated S class name.
This function is not intended to be called from S, but primarily from C code that has access to the COM references.
createCOMReference(ref, className)
createCOMReference(ref, className)
ref |
the S object that is an external pointer containing the reference to the COM object. |
className |
The name of the class that is “suggested” by the caller. |
An S object that should almost definitely contain
the ref
value. The class of the object should probably extend
IUnknown
.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs
Constants used to communicate between S and C code
to indicate how a COM call
should be invoked.
This can be used as the value of the .dispatch
argument in the .COM
function to control whether
to treat the call
as a property accessor, method call
or both.
data(DispatchMethods)
data(DispatchMethods)
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
This generic function is used to create an instance of a
value from an enumeration constant definition type.
See EnumValue-class
for more information
about these named symbolic constants.
EnumValue(id, value, obj = new("EnumValue"))
EnumValue(id, value, obj = new("EnumValue"))
id |
a string giving the symbolic name of the value. |
value |
the numeric value for this |
obj |
an instance of the class to be created.
This allows the caller to reuse this function with
for different derived classes of |
The value of the obj
argument with is .Data
slot
filled in with a named integer vector of length 1.
Duncan Temple Lang ([email protected])
This class is intended to be used to represent a value that originates from an enumerated constant. The idea is that this value carries around the value and the symbolic name. Additionally, if an object of a enumerated type is expected, an integer or character string could be supplied and its value compared to a definition of the enumeration in R.
It is expected that users would create new classes derived from this
one for each new enumeration type that is encountered. The definition
of the enumerated constant values would be identified from the class
name of the new class. See EnumValue
.
Objects can be created by calls of the form new("EnumValue", ...)
or via the function EnumValue
with an instance
of the appropriate target class specified.
.Data
:Object of class "integer"
,
giving the value. This must have the associated name
which makes it the symbolic constant.
Class "integer"
, from data part.
Class "vector"
, by class "integer"
.
Class "numeric"
, by class "integer"
.
signature(object = "EnumValue")
:
this takes care of displaying the value as a regular named integer
giving the human-readable form and its value.
Duncan Temple Lang ([email protected])
# Define a new Enumeration class. setClass("Color", contains = "EnumValue") # Define the enumeration definition table. ColorEnum = c(Red = 1, Green = 2, Blue = 3) storage.mode(ColorEnum) = "integer" # Set the coercion methods to take a number or a string # to this class type. setAs("character", "Color", function(from) EnumValue(from, new("Color"))) setAs("numeric", "Color", function(from) EnumValue(from, new("Color"))) # Now we can use this class. as(1, "Color") as("Red", "Color") as("Blue", "Color") # These should give errors, so we enclose them in a call to try. try(as("Orange", "Color")) try(as(20, "Color"))
# Define a new Enumeration class. setClass("Color", contains = "EnumValue") # Define the enumeration definition table. ColorEnum = c(Red = 1, Green = 2, Blue = 3) storage.mode(ColorEnum) = "integer" # Set the coercion methods to take a number or a string # to this class type. setAs("character", "Color", function(from) EnumValue(from, new("Color"))) setAs("numeric", "Color", function(from) EnumValue(from, new("Color"))) # Now we can use this class. as(1, "Color") as("Red", "Color") as("Blue", "Color") # These should give errors, so we enclose them in a call to try. try(as("Orange", "Color")) try(as(20, "Color"))
This function provides a way to find the
unique identifier for an application or interface
given its human-readable form, e.g. "Excel.Application".
This is convenient if you want to attempt to load the
type library without having an instance of the application
or if you want to use this information for looking
in the Windows registry ( - see the SWinRegistry
package).
getCLSID(appName)
getCLSID(appName)
appName |
the human-readable string (i.e. character vector of length 1) whose UUID we want to find. |
This is a interface to the C routines
CLSIDFromString
and CLSIDFromProgID
A string which gives the UUID.
If the UUID could not be found,
this (currently) returns the UUID of all zeros:
"{00000000-0000-0000-0000-000000000000}"
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
getCLSID("Excel.Application")
getCLSID("Excel.Application")
This is a class that we use to represent an error that was generated
in a COM call. If an object of this class is returned, then we know
that a call to .COM
failed. An object of this class
contains information about the error status, a description of the
error and a string giving the source of the error (e.g. the name of
the COM server).
The C++ code to use this is in place but is currently not activated.
Created in the C++ code when a COM call fails.
status
:Object of class "numeric"
the error status for the error.
This can be used with system codes to find the symbolic name.
See .COMErrors
in the package.
source
:Object of class "character"
a string giving the source of the error, e.g. the application name.
description
:Object of class "character"
the human-readable description of the error.
No methods defined with class "SCOMErrorInfo" in the signature.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs
The VARIANT
class provides a way to
represent a C-level VARIANT object in S
and assign it to S variable names.
The other classes are trivial extensions that provide type information about a
variant so that we can dispatch methods on such an object.
Currently created in C code when returning values from COM calls.
In the future, one will be able to create variant objects directly
from R and use them as arguments in .COM
calls.
Also we will provide methods for accessing the values of the variants,
and converting them to different S values.
ref
:Object of class "externalptr"
reference to the
C-level address of the variant data structure.
kind
:Object of class "integer"
the kind of the variant,
e.g. I8, I4, R8, BSTR, DISPATCH, etc. represented as a named integer
which has the value from the C-level enumeration.
No methods defined with class "VARIANT" in the signature.
Duncan Temple Lang ([email protected])
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs
This function allows one to query or set the flag that controls whether DCOM errors are appended to a file when they are encountered.
writeErrors(val = logical(), file = character())
writeErrors(val = logical(), file = character())
val |
a logical value. If this is not specified, the function queries the current logical value controlling whether DCOM errors are written to a file. If this is a logical value (not an empty vector), that value of the first element is used to set whether the DCOM errors are written to a file or not. |
file |
a character value. If this is not specified, the function queries the current location of the log file. If this is a character value (not an empty vector) the value of the first element is used as the location of the log file. The file will be created if it does not exist already. If the log file is not specified, but errors are being written, this will create a temporary log file. |
A list with an entry val, with the current status of whether errors are appended to the file and an entry file with the location of the log file, if any.
Duncan Temple Lang
writeErrors(TRUE, file = "C:/temp/RDCOM_err.log") writeErrors(FALSE) writeErrors() writeErrors(TRUE)
writeErrors(TRUE, file = "C:/temp/RDCOM_err.log") writeErrors(FALSE) writeErrors() writeErrors(TRUE)