Class: WIN32OLE_METHOD
- Inherits:
-
Object
- Object
- WIN32OLE_METHOD
- Defined in:
- win32ole.c,
win32ole.c
Overview
WIN32OLE_METHOD
objects represent OLE method information.
Instance Method Summary collapse
-
#dispid ⇒ Object
Returns dispatch ID.
-
#event? ⇒ Boolean
Returns true if the method is event.
-
#event_interface ⇒ Object
Returns event interface name if the method is event.
-
#helpcontext ⇒ Object
Returns help context.
-
#helpfile ⇒ Object
Returns help file.
-
#helpstring ⇒ Object
Returns help string of OLE method.
-
#new(ole_type, method) ⇒ WIN32OLE_METHOD object
constructor
Returns a new WIN32OLE_METHOD object which represents the information about OLE method.
-
#inspect ⇒ String
Returns the method name with class name.
-
#invkind ⇒ Object
Returns the method invoke kind.
-
#invoke_kind ⇒ Object
Returns the method kind string.
-
#name ⇒ Object
(also: #to_s)
call-seq WIN32OLE_METHOD#name.
-
#offset_vtbl ⇒ Object
Returns the offset ov VTBL.
-
#params ⇒ Object
returns array of WIN32OLE_PARAM object corresponding with method parameters.
-
#return_type ⇒ Object
Returns string of return value type of method.
-
#return_type_detail ⇒ Object
Returns detail information of return value type of method.
-
#return_vtype ⇒ Object
Returns number of return value type of method.
-
#size_opt_params ⇒ Object
Returns the size of optional parameters.
-
#size_params ⇒ Object
Returns the size of arguments of the method.
-
#visible? ⇒ Boolean
Returns true if the method is public.
Constructor Details
#new(ole_type, method) ⇒ WIN32OLE_METHOD object
Returns a new WIN32OLE_METHOD object which represents the information about OLE method. The first argument ole_type specifies WIN32OLE_TYPE object. The second argument method specifies OLE method name defined OLE class which represents WIN32OLE_TYPE object.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 |
# File 'win32ole.c', line 6594 static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method) { struct oletypedata *ptype; VALUE obj = Qnil; if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) { SafeStringValue(method); Data_Get_Struct(oletype, struct oletypedata, ptype); obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method); if (obj == Qnil) { rb_raise(eWIN32OLERuntimeError, "not found %s", StringValuePtr(method)); } } else { rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object"); } return obj; } |
Instance Method Details
#dispid ⇒ Object
Returns dispatch ID.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.dispid # => 181
7087 7088 7089 7090 7091 7092 7093 |
# File 'win32ole.c', line 7087 static VALUE folemethod_dispid(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_dispid(pmethod->pTypeInfo, pmethod->index); } |
#event? ⇒ Boolean
Returns true if the method is event.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
puts method.event? # => true
6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 |
# File 'win32ole.c', line 6915 static VALUE folemethod_event(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); if (!pmethod->pOwnerTypeInfo) return Qfalse; return ole_method_event(pmethod->pOwnerTypeInfo, pmethod->index, rb_ivar_get(self, rb_intern("name"))); } |
#event_interface ⇒ Object
Returns event interface name if the method is event.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SheetActivate')
puts method.event_interface # => WorkbookEvents
6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 |
# File 'win32ole.c', line 6936 static VALUE folemethod_event_interface(VALUE self) { BSTR name; struct olemethoddata *pmethod; HRESULT hr; Data_Get_Struct(self, struct olemethoddata, pmethod); if(folemethod_event(self) == Qtrue) { hr = ole_docinfo_from_type(pmethod->pTypeInfo, &name, NULL, NULL, NULL); if(SUCCEEDED(hr)) return WC2VSTR(name); } return Qnil; } |
#helpcontext ⇒ Object
Returns help context.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.helpcontext # => 65717
7056 7057 7058 7059 7060 7061 7062 |
# File 'win32ole.c', line 7056 static VALUE folemethod_helpcontext(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_helpcontext(pmethod->pTypeInfo, pmethod->index); } |
#helpfile ⇒ Object
Returns help file. If help file is not found, then the method returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.helpfile # => C:\...\VBAXL9.CHM
7026 7027 7028 7029 7030 7031 7032 7033 |
# File 'win32ole.c', line 7026 static VALUE folemethod_helpfile(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_helpfile(pmethod->pTypeInfo, pmethod->index); } |
#helpstring ⇒ Object
Returns help string of OLE method. If the help string is not found, then the method returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
method = WIN32OLE_METHOD.new(tobj, 'Navigate')
puts method.helpstring # => Navigates to a URL or file.
6996 6997 6998 6999 7000 7001 7002 |
# File 'win32ole.c', line 6996 static VALUE folemethod_helpstring(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index); } |
#inspect ⇒ String
Returns the method name with class name.
7257 7258 7259 7260 7261 |
# File 'win32ole.c', line 7257 static VALUE folemethod_inspect(VALUE self) { return default_inspect(self, "WIN32OLE_METHOD"); } |
#invkind ⇒ Object
Returns the method invoke kind.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.invkind # => 1
6777 6778 6779 6780 6781 6782 6783 |
# File 'win32ole.c', line 6777 static VALUE folemethod_invkind(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_invkind(pmethod->pTypeInfo, pmethod->index); } |
#invoke_kind ⇒ Object
Returns the method kind string. The string is “UNKNOWN” or “PROPERTY” or “PROPERTY” or “PROPERTYGET” or “PROPERTYPUT” or “PROPERTYPPUTREF” or “FUNC”.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.invoke_kind # => "FUNC"
6796 6797 6798 6799 6800 6801 6802 |
# File 'win32ole.c', line 6796 static VALUE folemethod_invoke_kind(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index); } |
#name ⇒ Object Also known as: to_s
call-seq
WIN32OLE_METHOD#name
Returns the name of the method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
puts method.name # => SaveAs
6625 6626 6627 6628 6629 |
# File 'win32ole.c', line 6625 static VALUE folemethod_name(VALUE self) { return rb_ivar_get(self, rb_intern("name")); } |
#offset_vtbl ⇒ Object
Returns the offset ov VTBL.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.offset_vtbl # => 40
7118 7119 7120 7121 7122 7123 7124 |
# File 'win32ole.c', line 7118 static VALUE folemethod_offset_vtbl(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_offset_vtbl(pmethod->pTypeInfo, pmethod->index); } |
#params ⇒ Object
returns array of WIN32OLE_PARAM object corresponding with method parameters.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
p method.params # => [Filename, FileFormat, Password, WriteResPassword,
ReadOnlyRecommended, CreateBackup, AccessMode,
ConflictResolution, AddToMru, TextCodepage,
TextVisualLayout]
7242 7243 7244 7245 7246 7247 7248 |
# File 'win32ole.c', line 7242 static VALUE folemethod_params(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_params(pmethod->pTypeInfo, pmethod->index); } |
#return_type ⇒ Object
Returns string of return value type of method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.return_type # => Workbook
6657 6658 6659 6660 6661 6662 6663 |
# File 'win32ole.c', line 6657 static VALUE folemethod_return_type(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_return_type(pmethod->pTypeInfo, pmethod->index); } |
#return_type_detail ⇒ Object
Returns detail information of return value type of method. The information is array.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]
6725 6726 6727 6728 6729 6730 6731 |
# File 'win32ole.c', line 6725 static VALUE folemethod_return_type_detail(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index); } |
#return_vtype ⇒ Object
Returns number of return value type of method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.return_vtype # => 26
6691 6692 6693 6694 6695 6696 6697 |
# File 'win32ole.c', line 6691 static VALUE folemethod_return_vtype(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index); } |
#size_opt_params ⇒ Object
Returns the size of optional parameters.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
puts method.size_opt_params # => 4
7181 7182 7183 7184 7185 7186 7187 |
# File 'win32ole.c', line 7181 static VALUE folemethod_size_opt_params(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_size_opt_params(pmethod->pTypeInfo, pmethod->index); } |
#size_params ⇒ Object
Returns the size of arguments of the method.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
puts method.size_params # => 11
7150 7151 7152 7153 7154 7155 7156 |
# File 'win32ole.c', line 7150 static VALUE folemethod_size_params(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_size_params(pmethod->pTypeInfo, pmethod->index); } |
#visible? ⇒ Boolean
Returns true if the method is public.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE_METHOD.new(tobj, 'Add')
puts method.visible? # => true
6833 6834 6835 6836 6837 6838 6839 |
# File 'win32ole.c', line 6833 static VALUE folemethod_visible(VALUE self) { struct olemethoddata *pmethod; Data_Get_Struct(self, struct olemethoddata, pmethod); return ole_method_visible(pmethod->pTypeInfo, pmethod->index); } |