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 = NULL;
BSTR wcmdname;
DISPID DispID;
HRESULT hr;
if(!RB_TYPE_P(method, T_STRING) && !RB_TYPE_P(method, T_SYMBOL)) {
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
if (RB_TYPE_P(method, T_SYMBOL)) {
method = rb_sym2str(method);
}
pole = oledata_get_struct(self);
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;
}