Class: WIN32OLE_TYPE
Relationships & Source Files | |
Inherits: | Object |
Defined in: | ext/win32ole/win32ole_type.c, ext/win32ole/win32ole_type.c |
Overview
WIN32OLE_TYPE
objects represent OLE type libarary information.
Class Method Summary
-
.new(typelib, ole_class) ⇒ WIN32OLE_TYPE
constructor
Returns a new
WIN32OLE_TYPE
object. -
.ole_classes(typelib)
Returns array of
WIN32OLE_TYPE
objects defined by the typelib type library. -
.progids
Returns array of ProgID.
-
.typelibs
Returns array of type libraries.
Instance Attribute Summary
-
#visible?(#=> true or false)
readonly
Returns true if the OLE class is public.
Instance Method Summary
-
#default_event_sources
Returns the array of
WIN32OLE_TYPE
object which is implemented by theWIN32OLE_TYPE
object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT. -
#default_ole_types
Returns the array of
WIN32OLE_TYPE
object which is implemented by theWIN32OLE_TYPE
object and having IMPLTYPEFLAG_FDEFAULT. -
#guid(#=> GUID)
Returns GUID.
-
#helpcontext
Returns helpcontext.
-
#helpfile
Returns helpfile path.
-
#helpstring(#=> help string.)
Returns help string.
-
#implemented_ole_types
Returns the array of
WIN32OLE_TYPE
object which is implemented by theWIN32OLE_TYPE
object. -
#inspect ⇒ String
Returns the type name with class name.
-
#major_version
Returns major version.
-
#minor_version(#=> OLE minor version)
Returns minor version.
-
#name(#=> OLE type name)
Alias for #to_s.
-
#ole_methods(# the array of WIN32OLE_METHOD objects.)
Returns array of ::WIN32OLE_METHOD objects which represent OLE method defined in OLE type library.
-
#ole_type(#=> OLE type string.)
returns type of OLE class.
-
#ole_typelib
Returns the ::WIN32OLE_TYPELIB object which is including the
WIN32OLE_TYPE
object. -
#progid(#=> ProgID)
Returns ProgID if it exists.
-
#source_ole_types
Returns the array of
WIN32OLE_TYPE
object which is implemented by theWIN32OLE_TYPE
object and having IMPLTYPEFLAG_FSOURCE. -
#src_type(#=> OLE source class)
Returns source class when the OLE class is 'Alias'.
-
#to_s(#=> OLE type name)
(also: #name)
Returns OLE type name.
-
#typekind(#=> number of type.)
Returns number which represents type.
-
#variables
Returns array of ::WIN32OLE_VARIABLE objects which represent variables defined in OLE class.
Constructor Details
.new(typelib, ole_class) ⇒ WIN32OLE_TYPE
Returns a new WIN32OLE_TYPE
object. The first argument typelib specifies OLE type library name. The second argument specifies OLE class name.
WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
# => WIN32OLE_TYPE object of Application class of Excel.
Class Method Details
.ole_classes(typelib)
Returns array of WIN32OLE_TYPE
objects defined by the typelib type library. This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead.
.progids
Returns array of ProgID.
.typelibs
Returns array of type libraries. This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead.
Instance Attribute Details
#visible?(#=> true or false) (readonly)
Returns true if the OLE class is public.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible # => true
Instance Method Details
#default_event_sources
Returns the array of WIN32OLE_TYPE
object which is implemented by the WIN32OLE_TYPE
object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
p tobj.default_event_sources # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>]
#default_ole_types
Returns the array of WIN32OLE_TYPE
object which is implemented by the WIN32OLE_TYPE
object and having IMPLTYPEFLAG_FDEFAULT.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
p tobj.default_ole_types
# => [#<WIN32OLE_TYPE:IWebBrowser2>, #<WIN32OLE_TYPE:DWebBrowserEvents2>]
#guid(#=> GUID)
Returns GUID.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.guid # => {00024500-0000-0000-C000-000000000046}
#helpcontext
#helpfile
Returns helpfile path. If helpfile is not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => C:\...\VBAXL9.CHM
#helpstring(#=> help string.)
Returns help string.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
puts tobj.helpstring # => Web Browser interface
#implemented_ole_types
Returns the array of WIN32OLE_TYPE
object which is implemented by the WIN32OLE_TYPE
object.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
p tobj.implemented_ole_types # => [_Worksheet, DocEvents]
#inspect ⇒ String
Returns the type name with class name.
ie = WIN32OLE.new('InternetExplorer.Application')
ie.ole_type.inspect => #<WIN32OLE_TYPE:IWebBrowser2>
#major_version
Returns major version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.major_version # => 8
#minor_version(#=> OLE minor version)
Returns minor version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.minor_version # => 2
#to_s(#=> OLE type name)
#name(#=> OLE type name)
Alias for #to_s.
#ole_methods(# the array of WIN32OLE_METHOD objects.)
Returns array of ::WIN32OLE_METHOD objects which represent OLE method defined in OLE type library.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
methods = tobj.ole_methods.collect{|m|
m.name
}
# => ['Activate', 'Copy', 'Delete',....]
#ole_type(#=> OLE type string.)
returns type of OLE class.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.ole_type # => Class
#ole_typelib
Returns the ::WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE
object. If it is not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library'
#progid(#=> ProgID)
Returns ProgID if it exists. If not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.progid # => Excel.Application.9
#source_ole_types
Returns the array of WIN32OLE_TYPE
object which is implemented by the WIN32OLE_TYPE
object and having IMPLTYPEFLAG_FSOURCE.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer")
p tobj.source_ole_types
# => [#<WIN32OLE_TYPE:DWebBrowserEvents2>, #<WIN32OLE_TYPE:DWebBrowserEvents>]
#src_type(#=> OLE source class)
Returns source class when the OLE class is 'Alias'.
tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
puts tobj.src_type # => I4
#to_s(#=> OLE type name) Also known as: #name
#typekind(#=> number of type.)
Returns number which represents type.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.typekind # => 4
#variables
Returns array of ::WIN32OLE_VARIABLE objects which represent variables defined in OLE class.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
puts "#{v.name} = #{v.value}"
end
The result of above sample script is follows:
xlChart = -4109
xlDialogSheet = -4116
xlExcel4IntlMacroSheet = 4
xlExcel4MacroSheet = 3
xlWorksheet = -4167