COM: Full access to client COM invocation

.COMR Documentation

Full access to client COM invocation

Description

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.

Usage

.COM(obj, name, ..., .dispatch = 3L, .return = TRUE, 
      .ids = numeric(0), .suppliedArgs)

Arguments

obj

the COM object reference, usually obtained via COMCreate.

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 DispatchMethods values indicating the target of the invocation: a method or a property, and whether to get or set the property. In some cases, one wants to specify both a method and a property which is done by OR'ing the values in DispatchMethods in the bit-wise sense of OR'ing.

.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 MEMBERID values which identify the names of the method and parameters used in the call. Supplying these avoids the need for an extra communication step with the COM object to map the names to identifiers. One must compute these values using the type library (see getNameIDs) or via other type information gathered from the object or another type library tool, e.g. oleviewer, Visual Basic Editor's type brower.

.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 .COM function is generated, this provides a way to specify which are actual arguments and which are default values for arguments.

Value

An arbitrary value obtained from converting the value returned from the COM invocation.

Note

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.

Author(s)

Duncan Temple Lang (duncan@r-project.org)

References

http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry

See Also

COMCreate COMAccessors getNameIDs

Examples


 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)

omegahat/RDCOMClient documentation built on July 24, 2022, 5:45 a.m.