ole_method(p1)
public
Show source
/*
* call-seq:
* WIN32OLE#ole_method_help(method)
*
* Returns WIN32OLE_METHOD object corresponding with method
* specified by 1st argument.
*
* excel = WIN32OLE.new('Excel.Application')
* method = excel.ole_method_help('Quit')
*
*/
static VALUE
fole_method_help( self, cmdname )
VALUE self;
VALUE cmdname;
{
ITypeInfo *pTypeInfo;
HRESULT hr;
struct oledata *pole;
VALUE method, obj;
LCID lcid = LOCALE_SYSTEM_DEFAULT;
Check_SafeStr(cmdname);
OLEData_Get_Struct(self, pole);
hr = typeinfo_from_ole(pole, &pTypeInfo);
if(FAILED(hr))
ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
method = folemethod_s_allocate(cWIN32OLE_METHOD);
obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
OLE_RELEASE(pTypeInfo);
if (obj == Qnil)
rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found %s",
StringValuePtr(cmdname));
return obj;
}