ole_show_help(p1, p2 = v2)
public
Show source
static VALUE
fole_s_show_help(int argc, VALUE *argv, VALUE self)
{
VALUE target;
VALUE helpcontext;
VALUE helpfile;
VALUE name;
HWND hwnd;
rb_scan_args(argc, argv, "11", &target, &helpcontext);
if (rb_obj_is_kind_of(target, cWIN32OLE_TYPE) ||
rb_obj_is_kind_of(target, cWIN32OLE_METHOD)) {
helpfile = rb_funcall(target, rb_intern("helpfile"), 0);
if(strlen(StringValuePtr(helpfile)) == 0) {
name = rb_ivar_get(target, rb_intern("name"));
rb_raise(rb_eRuntimeError, "no helpfile of `%s'",
StringValuePtr(name));
}
helpcontext = rb_funcall(target, rb_intern("helpcontext"), 0);
} else {
helpfile = target;
}
if (!RB_TYPE_P(helpfile, T_STRING)) {
rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)");
}
hwnd = ole_show_help(helpfile, helpcontext);
if(hwnd == 0) {
rb_raise(rb_eRuntimeError, "failed to open help file `%s'",
StringValuePtr(helpfile));
}
return Qnil;
}