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')
6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 |
# File 'win32ole.c', line 6568
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
7061 7062 7063 7064 7065 7066 7067 |
# File 'win32ole.c', line 7061
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
6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 |
# File 'win32ole.c', line 6889
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
6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 |
# File 'win32ole.c', line 6910
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
7030 7031 7032 7033 7034 7035 7036 |
# File 'win32ole.c', line 7030
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
7000 7001 7002 7003 7004 7005 7006 7007 |
# File 'win32ole.c', line 7000
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.
6970 6971 6972 6973 6974 6975 6976 |
# File 'win32ole.c', line 6970
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.
7231 7232 7233 7234 7235 |
# File 'win32ole.c', line 7231
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
6751 6752 6753 6754 6755 6756 6757 |
# File 'win32ole.c', line 6751
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"
6770 6771 6772 6773 6774 6775 6776 |
# File 'win32ole.c', line 6770
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
6599 6600 6601 6602 6603 |
# File 'win32ole.c', line 6599
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
7092 7093 7094 7095 7096 7097 7098 |
# File 'win32ole.c', line 7092
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]
7216 7217 7218 7219 7220 7221 7222 |
# File 'win32ole.c', line 7216
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
6631 6632 6633 6634 6635 6636 6637 |
# File 'win32ole.c', line 6631
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"]
6699 6700 6701 6702 6703 6704 6705 |
# File 'win32ole.c', line 6699
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
6665 6666 6667 6668 6669 6670 6671 |
# File 'win32ole.c', line 6665
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
7155 7156 7157 7158 7159 7160 7161 |
# File 'win32ole.c', line 7155
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
7124 7125 7126 7127 7128 7129 7130 |
# File 'win32ole.c', line 7124
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
6807 6808 6809 6810 6811 6812 6813 |
# File 'win32ole.c', line 6807
static VALUE
folemethod_visible(VALUE self)
{
struct olemethoddata *pmethod;
Data_Get_Struct(self, struct olemethoddata, pmethod);
return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
}
|