createCOMSClass         package:SWinTypeLibs         R Documentation

_G_e_n_e_r_a_t_e _S _c_l_a_s_s _m_i_r_r_o_r_i_n_g _C_O_M _c_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     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'.

_U_s_a_g_e:

     createCOMSClass(libEntry, className, where = NULL)

_A_r_g_u_m_e_n_t_s:

libEntry: the 'ITypeInfo-class' object describing the COM class.

className: the name to use for the new S class that is created

   where: unused at present.

_V_a_l_u_e:

     The name of the new S4 class.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang <duncan@wald.ucdavis.edu>

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://msdn.microsoft.com/library> <URL:
     http://www.omegahat.org/SWinTypeLibs>

_S_e_e _A_l_s_o:

     'computeFunctionInformation' 'generateOperators' 'getTypeInfo'
     'LoadTypeLib' 'createCOMReference'

_E_x_a_m_p_l_e_s:

     ## 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)

