123456789_123456789_123456789_123456789_123456789_

Class: WIN32OLE_TYPELIB

Relationships & Source Files
Inherits: Object
Defined in: ext/win32ole/win32ole_typelib.c,
ext/win32ole/win32ole_typelib.c

Overview

WIN32OLE_TYPELIB objects represent OLE tyblib information.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(typelib [, version1, version2]) ⇒ WIN32OLE_TYPELIB

Returns a new WIN32OLE_TYPELIB object.

The first argument typelib specifies OLE type library name or GUID or OLE library file. The second argument is major version or version of the type library. The third argument is minor version. The second argument and third argument are optional. If the first argument is type library name, then the second and third argument are ignored.

tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}')
tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3)
tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3)
tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL")
puts tlib1.name  # -> 'Microsoft Excel 9.0 Object Library'
puts tlib2.name  # -> 'Microsoft Excel 9.0 Object Library'
puts tlib3.name  # -> 'Microsoft Excel 9.0 Object Library'
puts tlib4.name  # -> 'Microsoft Excel 9.0 Object Library'
puts tlib5.name  # -> 'Microsoft Shell Controls And Automation'

Class Method Details

.typelibs

Returns the array of WIN32OLE_TYPELIB object.

tlibs = WIN32OLE_TYPELIB.typelibs

Instance Attribute Details

#visible?Boolean (readonly)

Returns true if the type library information is not hidden. If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN, the method returns false, otherwise, returns true. If the method fails to access the TLIBATTR information, then ::WIN32OLERuntimeError is raised.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
tlib.visible? # => true

Instance Method Details

#guidThe guid string.

Returns guid string which specifies type library.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
guid = tlib.guid # -> '{00020813-0000-0000-C000-000000000046}'

#inspectString

Returns the type library name with class name.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
tlib.inspect # => "<#WIN32OLE_TYPELIB:Microsoft Excel 9.0 Object Library>"

#library_name

Returns library name. If the method fails to access library name, ::WIN32OLERuntimeError is raised.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
tlib.library_name # => Excel

#major_versionThe type library major version.

Returns the type library major version.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
puts tlib.major_version # -> 1

#minor_versionThe type library minor version.

Returns the type library minor version.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
puts tlib.minor_version # -> 3

#to_sThe type library name #nameThe type library name

Alias for #to_s.

#ole_typesThe array of WIN32OLE_TYPE object included the type library. #ole_classesThe array of WIN32OLE_TYPE object included the type library.

Alias for #ole_types.

#ole_typesThe array of WIN32OLE_TYPE object included the type library. Also known as: #ole_classes

Returns the type library file path.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...]

#pathThe type library file path.

Returns the type library file path.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
puts tlib.path #-> 'C:\...\EXCEL9.OLB'

#to_sThe type library name Also known as: #name

Returns the type library name.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
name = tlib.name # -> 'Microsoft Excel 9.0 Object Library'

#versionThe type library version String object.

Returns the type library version.

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library')
puts tlib.version #-> "1.3"