本文整理汇总了C++中IDispatch_AddRef函数的典型用法代码示例。如果您正苦于以下问题:C++ IDispatch_AddRef函数的具体用法?C++ IDispatch_AddRef怎么用?C++ IDispatch_AddRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IDispatch_AddRef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: jsval_copy
HRESULT jsval_copy(jsval_t v, jsval_t *r)
{
switch(jsval_type(v)) {
case JSV_UNDEFINED:
case JSV_NULL:
case JSV_NUMBER:
case JSV_BOOL:
*r = v;
return S_OK;
case JSV_OBJECT:
if(get_object(v))
IDispatch_AddRef(get_object(v));
*r = v;
return S_OK;
case JSV_STRING: {
jsstr_addref(get_string(v));
*r = v;
return S_OK;
}
case JSV_VARIANT:
return jsval_variant(r, get_variant(v));
}
assert(0);
return E_FAIL;
}
开发者ID:bfg-repo-cleaner-demos,项目名称:wine-original,代码行数:26,代码来源:jsutils.c
示例2: Test_InvokeEx
static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
ok(pspCaller != NULL, "pspCaller == NULL\n");
switch(id) {
case DISPID_TEST_TESTARGCONV:
CHECK_EXPECT(testArgConv);
ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(!pvarRes, "pvarRes != NULL\n");
ok(pei != NULL, "pei == NULL\n");
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(rgvarg) = %d\n", V_VT(pdp->rgvarg));
test_caller(pspCaller, V_DISPATCH(pdp->rgvarg));
stored_obj = V_DISPATCH(pdp->rgvarg);
IDispatch_AddRef(stored_obj);
break;
default:
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
return S_OK;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:31,代码来源:caller.c
示例3: HTMLDOMChildrenCollection_item
static HRESULT WINAPI HTMLDOMChildrenCollection_item(IHTMLDOMChildrenCollection *iface, LONG index, IDispatch **ppItem)
{
HTMLDOMChildrenCollection *This = impl_from_IHTMLDOMChildrenCollection(iface);
nsIDOMNode *nsnode = NULL;
HTMLDOMNode *node;
PRUint32 length=0;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%d %p)\n", This, index, ppItem);
if (ppItem)
*ppItem = NULL;
else
return E_POINTER;
nsIDOMNodeList_GetLength(This->nslist, &length);
if(index < 0 || index >= length)
return E_INVALIDARG;
nsres = nsIDOMNodeList_Item(This->nslist, index, &nsnode);
if(NS_FAILED(nsres) || !nsnode) {
ERR("Item failed: %08x\n", nsres);
return E_FAIL;
}
hres = get_node(This->doc, nsnode, TRUE, &node);
if(FAILED(hres))
return hres;
*ppItem = (IDispatch*)&node->IHTMLDOMNode_iface;
IDispatch_AddRef(*ppItem);
return S_OK;
}
开发者ID:mgriepentrog,项目名称:wine,代码行数:34,代码来源:htmlnode.c
示例4: attach_event
HRESULT attach_event(EventTarget *event_target, BSTR name, IDispatch *disp, VARIANT_BOOL *res)
{
event_target_t *data;
eventid_t eid;
DWORD i = 0;
eid = attr_to_eid(name);
if(eid == EVENTID_LAST) {
WARN("Unknown event\n");
*res = VARIANT_TRUE;
return S_OK;
}
data = get_event_target_data(event_target, TRUE);
if(!data)
return E_OUTOFMEMORY;
if(data->event_table[eid]) {
while(i < data->event_table[eid]->handler_cnt && data->event_table[eid]->handlers[i])
i++;
if(i == data->event_table[eid]->handler_cnt && !alloc_handler_vector(data, eid, i+1))
return E_OUTOFMEMORY;
}else if(!alloc_handler_vector(data, eid, i+1)) {
return E_OUTOFMEMORY;
}
IDispatch_AddRef(disp);
data->event_table[eid]->handlers[i] = disp;
bind_event(event_target, eid);
*res = VARIANT_TRUE;
return S_OK;
}
开发者ID:Crobin83,项目名称:wine,代码行数:34,代码来源:htmlevent.c
示例5: attach_event
HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR name,
IDispatch *disp, VARIANT_BOOL *res)
{
event_target_t *event_target;
eventid_t eid;
DWORD i = 0;
eid = attr_to_eid(name);
if(eid == EVENTID_LAST) {
WARN("Unknown event\n");
*res = VARIANT_TRUE;
return S_OK;
}
event_target = get_event_target(event_target_ptr);
if(!event_target)
return E_OUTOFMEMORY;
if(event_target->event_table[eid]) {
while(i < event_target->event_table[eid]->handler_cnt && event_target->event_table[eid]->handlers[i])
i++;
if(i == event_target->event_table[eid]->handler_cnt && !alloc_handler_vector(event_target, eid, i+1))
return E_OUTOFMEMORY;
}else if(!alloc_handler_vector(event_target, eid, i+1)) {
return E_OUTOFMEMORY;
}
IDispatch_AddRef(disp);
event_target->event_table[eid]->handlers[i] = disp;
*res = VARIANT_TRUE;
return ensure_nsevent_handler(doc->doc_node, event_target, eid);
}
开发者ID:PigFlyGames,项目名称:wine,代码行数:33,代码来源:htmlevent.c
示例6: function_invoke
static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res,
EXCEPINFO *ei)
{
HRESULT hres;
switch(flags) {
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
if(!res)
return E_INVALIDARG;
/* fall through */
case DISPATCH_METHOD:
hres = typeinfo_invoke(This, func, flags, dp, res, ei);
break;
case DISPATCH_PROPERTYGET: {
dispex_dynamic_data_t *dynamic_data;
if(func->id == DISPID_VALUE) {
BSTR ret;
ret = SysAllocString(objectW);
if(!ret)
return E_OUTOFMEMORY;
V_VT(res) = VT_BSTR;
V_BSTR(res) = ret;
return S_OK;
}
dynamic_data = get_dynamic_data(This);
if(!dynamic_data)
return E_OUTOFMEMORY;
if(!dynamic_data->func_disps) {
dynamic_data->func_disps = heap_alloc_zero(This->data->data->func_disp_cnt * sizeof(func_disp_t*));
if(!dynamic_data->func_disps)
return E_OUTOFMEMORY;
}
if(!dynamic_data->func_disps[func->func_disp_idx]) {
dynamic_data->func_disps[func->func_disp_idx] = create_func_disp(This, func);
if(!dynamic_data->func_disps[func->func_disp_idx])
return E_OUTOFMEMORY;
}
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = (IDispatch*)&dynamic_data->func_disps[func->func_disp_idx]->dispex.IDispatchEx_iface;
IDispatch_AddRef(V_DISPATCH(res));
hres = S_OK;
break;
}
default:
FIXME("Unimplemented flags %x\n", flags);
/* fall through */
case DISPATCH_PROPERTYPUT:
hres = E_NOTIMPL;
}
return hres;
}
开发者ID:bpon,项目名称:wine,代码行数:59,代码来源:dispex.c
示例7: variant_to_jsval
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
{
switch(V_VT(var)) {
case VT_EMPTY:
*r = jsval_undefined();
return S_OK;
case VT_NULL:
*r = jsval_null();
return S_OK;
case VT_BOOL:
*r = jsval_bool(V_BOOL(var));
return S_OK;
case VT_I4:
*r = jsval_number(V_I4(var));
return S_OK;
case VT_R8:
*r = jsval_number(V_R8(var));
return S_OK;
case VT_BSTR: {
jsstr_t *str;
str = jsstr_alloc_len(V_BSTR(var), SysStringLen(V_BSTR(var)));
if(!str)
return E_OUTOFMEMORY;
if(!V_BSTR(var))
str->length_flags |= JSSTR_FLAG_NULLBSTR;
*r = jsval_string(str);
return S_OK;
}
case VT_DISPATCH: {
if(V_DISPATCH(var))
IDispatch_AddRef(V_DISPATCH(var));
*r = jsval_disp(V_DISPATCH(var));
return S_OK;
}
case VT_I2:
*r = jsval_number(V_I2(var));
return S_OK;
case VT_INT:
*r = jsval_number(V_INT(var));
return S_OK;
case VT_UNKNOWN:
if(V_UNKNOWN(var)) {
IDispatch *disp;
HRESULT hres;
hres = IUnknown_QueryInterface(V_UNKNOWN(var), &IID_IDispatch, (void**)&disp);
if(SUCCEEDED(hres)) {
*r = jsval_disp(disp);
return S_OK;
}
}
/* fall through */
default:
return jsval_variant(r, var);
}
}
开发者ID:bfg-repo-cleaner-demos,项目名称:wine-original,代码行数:58,代码来源:jsutils.c
示例8: get_item_idx
static HRESULT get_item_idx(HTMLElementCollection *This, UINT idx, IDispatch **ret)
{
if(idx < This->len) {
*ret = (IDispatch*)This->elems[idx];
IDispatch_AddRef(*ret);
}
return S_OK;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:9,代码来源:htmlelemcol.c
示例9: get_item_idx
static HRESULT get_item_idx(HTMLElementCollection *This, UINT idx, IDispatch **ret)
{
if(idx < This->len) {
*ret = (IDispatch*)&This->elems[idx]->node.event_target.dispex.IDispatchEx_iface;
IDispatch_AddRef(*ret);
}
return S_OK;
}
开发者ID:mstefani,项目名称:wine-stable,代码行数:9,代码来源:htmlelemcol.c
示例10: JScript_AddNamedItem
static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
LPCOLESTR pstrName, DWORD dwFlags)
{
JScript *This = impl_from_IActiveScript(iface);
named_item_t *item;
IDispatch *disp = NULL;
HRESULT hres;
TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;
if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) {
IUnknown *unk;
hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
if(FAILED(hres)) {
WARN("GetItemInfo failed: %08x\n", hres);
return hres;
}
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
IUnknown_Release(unk);
if(FAILED(hres)) {
WARN("object does not implement IDispatch\n");
return hres;
}
if(This->ctx->host_global)
IDispatch_Release(This->ctx->host_global);
IDispatch_AddRef(disp);
This->ctx->host_global = disp;
}
item = heap_alloc(sizeof(*item));
if(!item) {
if(disp)
IDispatch_Release(disp);
return E_OUTOFMEMORY;
}
item->disp = disp;
item->flags = dwFlags;
item->name = heap_strdupW(pstrName);
if(!item->name) {
if(disp)
IDispatch_Release(disp);
heap_free(item);
return E_OUTOFMEMORY;
}
item->next = This->ctx->named_items;
This->ctx->named_items = item;
return S_OK;
}
开发者ID:AndreRH,项目名称:wine,代码行数:57,代码来源:jscript.c
示例11: HTMLFormElement_get_elements
static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
{
HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
TRACE("(%p)->(%p)\n", This, p);
*p = (IDispatch*)&This->IHTMLFormElement_iface;
IDispatch_AddRef(*p);
return S_OK;
}
开发者ID:PigFlyGames,项目名称:wine,代码行数:10,代码来源:htmlform.c
示例12: jsval_to_variant
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
{
switch(jsval_type(val)) {
case JSV_UNDEFINED:
V_VT(retv) = VT_EMPTY;
return S_OK;
case JSV_NULL:
V_VT(retv) = VT_NULL;
return S_OK;
case JSV_OBJECT:
V_VT(retv) = VT_DISPATCH;
if(get_object(val))
IDispatch_AddRef(get_object(val));
V_DISPATCH(retv) = get_object(val);
return S_OK;
case JSV_STRING: {
jsstr_t *str = get_string(val);
V_VT(retv) = VT_BSTR;
if(str->length_flags & JSSTR_FLAG_NULLBSTR) {
V_BSTR(retv) = NULL;
} else {
V_BSTR(retv) = SysAllocStringLen(NULL, jsstr_length(str));
if(V_BSTR(retv))
jsstr_flush(str, V_BSTR(retv));
else
return E_OUTOFMEMORY;
}
return S_OK;
}
case JSV_NUMBER: {
double n = get_number(val);
if(is_int32(n)) {
V_VT(retv) = VT_I4;
V_I4(retv) = n;
} else {
V_VT(retv) = VT_R8;
V_R8(retv) = n;
}
return S_OK;
}
case JSV_BOOL:
V_VT(retv) = VT_BOOL;
V_BOOL(retv) = get_bool(val) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
case JSV_VARIANT:
V_VT(retv) = VT_EMPTY;
return VariantCopy(retv, get_variant(val));
}
assert(0);
return E_FAIL;
}
开发者ID:RareHare,项目名称:reactos,代码行数:55,代码来源:jsutils.c
示例13: httprequest_put_onreadystatechange
static HRESULT WINAPI httprequest_put_onreadystatechange(IXMLHTTPRequest *iface, IDispatch *sink)
{
httprequest *This = impl_from_IXMLHTTPRequest( iface );
TRACE("(%p)->(%p)\n", This, sink);
if (This->sink) IDispatch_Release(This->sink);
if ((This->sink = sink)) IDispatch_AddRef(This->sink);
return S_OK;
}
开发者ID:YokoZar,项目名称:wine,代码行数:11,代码来源:httprequest.c
示例14: get_event_handler
HRESULT get_event_handler(event_target_t **event_target, eventid_t eid, VARIANT *var)
{
if(*event_target && (*event_target)->event_table[eid] && (*event_target)->event_table[eid]->handler_prop) {
V_VT(var) = VT_DISPATCH;
V_DISPATCH(var) = (*event_target)->event_table[eid]->handler_prop;
IDispatch_AddRef(V_DISPATCH(var));
}else {
V_VT(var) = VT_NULL;
}
return S_OK;
}
开发者ID:PigFlyGames,项目名称:wine,代码行数:12,代码来源:htmlevent.c
示例15: HTMLIFrame_get_document
static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
{
HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
if(!This->framebase.content_window || !This->framebase.content_window->doc) {
*p = NULL;
return S_OK;
}
*p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
IDispatch_AddRef(*p);
return S_OK;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:13,代码来源:htmliframe.c
示例16: WebBrowser_get_Application
static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
{
WebBrowser *This = WEBBROWSER_THIS(iface);
TRACE("(%p)->(%p)\n", This, ppDisp);
if(!ppDisp)
return E_POINTER;
*ppDisp = (IDispatch*)WEBBROWSER2(This);
IDispatch_AddRef(*ppDisp);
return S_OK;
}
开发者ID:bilboed,项目名称:wine,代码行数:13,代码来源:webbrowser.c
示例17: WebBrowser_get_Application
static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
TRACE("(%p)->(%p)\n", This, ppDisp);
if(!ppDisp)
return E_POINTER;
*ppDisp = (IDispatch*)&This->IWebBrowser2_iface;
IDispatch_AddRef(*ppDisp);
return S_OK;
}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:13,代码来源:webbrowser.c
示例18: HTMLDOMNode2_get_ownerDocument
static HRESULT WINAPI HTMLDOMNode2_get_ownerDocument(IHTMLDOMNode2 *iface, IDispatch **p)
{
HTMLDOMNode *This = impl_from_IHTMLDOMNode2(iface);
TRACE("(%p)->(%p)\n", This, p);
/* FIXME: Better check for document node */
if(This == &This->doc->node) {
*p = NULL;
}else {
*p = (IDispatch*)&This->doc->basedoc.IHTMLDocument2_iface;
IDispatch_AddRef(*p);
}
return S_OK;
}
开发者ID:mgriepentrog,项目名称:wine,代码行数:15,代码来源:htmlnode.c
示例19: dispevent_QueryInterface
static HRESULT WINAPI dispevent_QueryInterface(IDispatch *iface, REFIID riid, void **ppvObject)
{
*ppvObject = NULL;
if ( IsEqualGUID( riid, &IID_IDispatch) ||
IsEqualGUID( riid, &IID_IUnknown) )
{
*ppvObject = iface;
}
else
return E_NOINTERFACE;
IDispatch_AddRef( iface );
return S_OK;
}
开发者ID:Barrell,项目名称:wine,代码行数:16,代码来源:httpreq.c
示例20: JScript_GetScriptDispatch
static HRESULT WINAPI JScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName,
IDispatch **ppdisp)
{
JScript *This = impl_from_IActiveScript(iface);
TRACE("(%p)->(%p)\n", This, ppdisp);
if(!ppdisp)
return E_POINTER;
if(This->thread_id != GetCurrentThreadId() || !This->ctx->global) {
*ppdisp = NULL;
return E_UNEXPECTED;
}
*ppdisp = to_disp(This->ctx->global);
IDispatch_AddRef(*ppdisp);
return S_OK;
}
开发者ID:AndreRH,项目名称:wine,代码行数:19,代码来源:jscript.c
注:本文中的IDispatch_AddRef函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论