Class: WIN32OLE_METHOD
- Inherits:
-
Object
- Object
- WIN32OLE_METHOD
- Defined in:
- win32ole.c
Overview
WIN32OLE_METHOD
objects represent OLE method information.
Instance Method Summary collapse
-
#dispid ⇒ Object
Returns dispatch ID.
-
#event? ⇒ Object
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.
-
#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? ⇒ Object
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')
|
# File 'win32ole.c'
static VALUE
folemethod_initialize(self, oletype, method)
VALUE self;
VALUE oletype;
VALUE method;
{
struct oletypedata *ptype;
VALUE obj = Qnil;
if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
Check_SafeStr(method);
Data_Get_Struct(oletype, struct oletypedata, ptype);
obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method);
if (obj == Qnil) {
rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found %s",
StringValuePtr(method));
}
|
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
|
# File 'win32ole.c'
static VALUE
folemethod_dispid(self)
VALUE self;
{
struct olemethoddata *pmethod;
Data_Get_Struct(self, struct olemethoddata, pmethod);
return ole_method_dispid(pmethod->pTypeInfo, pmethod->index);
}
|
#event? ⇒ Object
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
|
# File 'win32ole.c'
static VALUE
folemethod_event(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_event_interface(self)
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);
}
|
#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
|
# File 'win32ole.c'
static VALUE
folemethod_helpcontext(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_helpfile(self)
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.
|
# File 'win32ole.c'
static VALUE
folemethod_helpstring(self)
VALUE self;
{
struct olemethoddata *pmethod;
Data_Get_Struct(self, struct olemethoddata, pmethod);
return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index);
}
|
#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
|
# File 'win32ole.c'
static VALUE
folemethod_invkind(self)
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"
|
# File 'win32ole.c'
static VALUE
folemethod_invoke_kind(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_name(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_offset_vtbl(self)
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]
|
# File 'win32ole.c'
static VALUE
folemethod_params(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_return_type(self)
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"]
|
# File 'win32ole.c'
static VALUE
folemethod_return_type_detail(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_return_vtype(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_size_opt_params(self)
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
|
# File 'win32ole.c'
static VALUE
folemethod_size_params(self)
VALUE self;
{
struct olemethoddata *pmethod;
Data_Get_Struct(self, struct olemethoddata, pmethod);
return ole_method_size_params(pmethod->pTypeInfo, pmethod->index);
}
|
#visible? ⇒ Object
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
|
# File 'win32ole.c'
static VALUE
folemethod_visible(self)
VALUE self;
{
struct olemethoddata *pmethod;
Data_Get_Struct(self, struct olemethoddata, pmethod);
return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
}
|