ole_respond_to?(p1)
public
Returns true when OLE object has OLE method, otherwise returns false.
ie = WIN32OLE.new('InternetExplorer.Application')
ie.ole_respond_to?("gohome") => true
static VALUE
fole_respond_to(VALUE self, VALUE method)
{
struct oledata *pole;
BSTR wcmdname;
DISPID DispID;
HRESULT hr;
if(TYPE(method) != T_STRING && TYPE(method) != T_SYMBOL) {
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
if (TYPE(method) == T_SYMBOL) {
method = rb_sym_to_s(method);
}
OLEData_Get_Struct(self, pole);
wcmdname = ole_vstr2wc(method);
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
&wcmdname, 1, cWIN32OLE_lcid, &DispID);
SysFreeString(wcmdname);
return SUCCEEDED(hr) ? Qtrue : Qfalse;
}