3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
|
# File 'win32ole.c', line 3581
static VALUE
fole_query_interface(VALUE self, VALUE str_iid)
{
HRESULT hr;
OLECHAR *pBuf;
IID iid;
struct oledata *pole = NULL;
IDispatch *pDispatch;
void *p;
pBuf = ole_vstr2wc(str_iid);
hr = CLSIDFromString(pBuf, &iid);
SysFreeString(pBuf);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError,
"invalid iid: `%s'",
StringValuePtr(str_iid));
}
pole = oledata_get_struct(self);
if(!pole->pDispatch) {
rb_raise(rb_eRuntimeError, "failed to get dispatch interface");
}
hr = pole->pDispatch->lpVtbl->QueryInterface(pole->pDispatch, &iid,
&p);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLEQueryInterfaceError,
"failed to get interface `%s'",
StringValuePtr(str_iid));
}
pDispatch = p;
return create_win32ole_object(cWIN32OLE, pDispatch, 0, 0);
}
|