本文整理汇总了C++中IMoniker_Release函数的典型用法代码示例。如果您正苦于以下问题:C++ IMoniker_Release函数的具体用法?C++ IMoniker_Release怎么用?C++ IMoniker_Release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMoniker_Release函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_current_mon
void set_current_mon(HTMLWindow *This, IMoniker *mon)
{
HRESULT hres;
if(This->mon) {
IMoniker_Release(This->mon);
This->mon = NULL;
}
if(This->url) {
CoTaskMemFree(This->url);
This->url = NULL;
}
if(!mon)
return;
IMoniker_AddRef(mon);
This->mon = mon;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->url);
if(FAILED(hres))
WARN("GetDisplayName failed: %08x\n", hres);
set_script_mode(This, use_gecko_script(This->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
示例2: download_to_cache
HRESULT download_to_cache(IUri *uri, stop_cache_binding_proc_t proc, void *ctx, IBindStatusCallback *callback)
{
DownloadBSC *dwl_bsc;
IBindCtx *bindctx;
IMoniker *mon;
IUnknown *unk;
HRESULT hres;
hres = DownloadBSC_Create(callback, NULL, &dwl_bsc);
if(FAILED(hres))
return hres;
dwl_bsc->onstop_proc = proc;
dwl_bsc->ctx = ctx;
dwl_bsc->bindf = BINDF_ASYNCHRONOUS;
hres = CreateAsyncBindCtx(0, &dwl_bsc->IBindStatusCallback_iface, NULL, &bindctx);
IBindStatusCallback_Release(&dwl_bsc->IBindStatusCallback_iface);
if(FAILED(hres))
return hres;
hres = CreateURLMonikerEx2(NULL, uri, &mon, 0);
if(FAILED(hres)) {
IBindCtx_Release(bindctx);
return hres;
}
hres = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
IMoniker_Release(mon);
IBindCtx_Release(bindctx);
if(SUCCEEDED(hres) && unk)
IUnknown_Release(unk);
return hres;
}
示例3: IHlink_fnGetFriendlyName
static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
DWORD grfHLFNAMEF, LPWSTR* ppwzFriendlyName)
{
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p)\n", This, grfHLFNAMEF, ppwzFriendlyName);
/* FIXME: Only using explicitly set and cached friendly names */
if (This->FriendlyName)
*ppwzFriendlyName = hlink_co_strdupW( This->FriendlyName );
else
{
IMoniker *moniker;
HRESULT hres = __GetMoniker(This, &moniker, HLINKGETREF_DEFAULT);
if (FAILED(hres))
{
*ppwzFriendlyName = NULL;
return hres;
}
if (moniker)
{
IBindCtx *bcxt;
CreateBindCtx(0, &bcxt);
IMoniker_GetDisplayName(moniker, bcxt, NULL, ppwzFriendlyName);
IBindCtx_Release(bcxt);
IMoniker_Release(moniker);
}
else
*ppwzFriendlyName = NULL;
}
return S_OK;
}
示例4: PersistMoniker_Load
static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
IMoniker *pimkName, LPBC pibc, DWORD grfMode)
{
HTMLDocument *This = impl_from_IPersistMoniker(iface);
IMoniker *mon;
HRESULT hres;
TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
if(pibc) {
IUnknown *unk = NULL;
/* FIXME:
* Use params:
* "__PrecreatedObject"
* "BIND_CONTEXT_PARAM"
* "__HTMLLOADOPTIONS"
* "__DWNBINDINFO"
* "URL Context"
* "_ITransData_Object_"
* "_EnumFORMATETC_"
*/
hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
if(SUCCEEDED(hres) && unk) {
IOleClientSite *client = NULL;
hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
if(SUCCEEDED(hres)) {
TRACE("Got client site %p\n", client);
IOleObject_SetClientSite(&This->IOleObject_iface, client);
IOleClientSite_Release(client);
}
IUnknown_Release(unk);
}
}
if(This->doc_obj->is_mhtml) {
IUnknown *unk;
hres = MimeOleObjectFromMoniker(0, pimkName, pibc, &IID_IUnknown, (void**)&unk, &mon);
if(FAILED(hres))
return hres;
IUnknown_Release(unk);
pibc = NULL;
}else {
IMoniker_AddRef(mon = pimkName);
}
prepare_for_binding(This, mon, FALSE);
call_docview_84(This->doc_obj);
hres = set_moniker(This->window, mon, NULL, pibc, NULL, TRUE);
IMoniker_Release(mon);
if(FAILED(hres))
return hres;
return start_binding(This->window->pending_window, (BSCallback*)This->window->pending_window->bscallback, pibc);
}
示例5: xmldoc_put_URL
static HRESULT WINAPI xmldoc_put_URL(IXMLDocument *iface, BSTR p)
{
WCHAR url[INTERNET_MAX_URL_LENGTH];
IStream *stream;
IBindCtx *bctx;
IMoniker *moniker;
IPersistStreamInit *persist;
HRESULT hr;
TRACE("(%p, %s)\n", iface, debugstr_w(p));
if (!p)
return E_INVALIDARG;
if (!PathIsURLW(p))
{
WCHAR fullpath[MAX_PATH];
DWORD needed = sizeof(url) / sizeof(WCHAR);
if (!PathSearchAndQualifyW(p, fullpath, sizeof(fullpath) / sizeof(WCHAR)))
{
ERR("can't find path\n");
return E_FAIL;
}
if (FAILED(UrlCreateFromPathW(fullpath, url, &needed, 0)))
{
ERR("can't create url from path\n");
return E_FAIL;
}
p = url;
}
hr = CreateURLMoniker(NULL, p, &moniker);
if (FAILED(hr))
return hr;
CreateAsyncBindCtx(0, &xmldoc_bsc.IBindStatusCallback_iface, 0, &bctx);
hr = IMoniker_BindToStorage(moniker, bctx, NULL, &IID_IStream, (LPVOID *)&stream);
IBindCtx_Release(bctx);
IMoniker_Release(moniker);
if (FAILED(hr))
return hr;
hr = IXMLDocument_QueryInterface(iface, &IID_IPersistStreamInit, (LPVOID *)&persist);
if (FAILED(hr))
{
IStream_Release(stream);
return hr;
}
hr = IPersistStreamInit_Load(persist, stream);
IPersistStreamInit_Release(persist);
IStream_Release(stream);
return hr;
}
示例6: IHlink_fnNavigate
static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc,
IBindStatusCallback *pbsc, IHlinkBrowseContext *phbc)
{
HlinkImpl *This = impl_from_IHlink(iface);
IMoniker *mon = NULL;
HRESULT r;
FIXME("Semi-Stub:(%p)->(%i %p %p %p)\n", This, grfHLNF, pbc, pbsc, phbc);
r = __GetMoniker(This, &mon, HLINKGETREF_ABSOLUTE);
TRACE("Moniker %p\n", mon);
if (SUCCEEDED(r))
{
IBindCtx *bcxt;
IUnknown *unk = NULL;
IHlinkTarget *target;
CreateBindCtx(0, &bcxt);
RegisterBindStatusCallback(bcxt, pbsc, NULL, 0);
r = IMoniker_BindToObject(mon, bcxt, NULL, &IID_IUnknown, (void**)&unk);
if (r == S_OK)
{
r = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&target);
IUnknown_Release(unk);
}
if (r == S_OK)
{
IHlinkTarget_SetBrowseContext(target, phbc);
r = IHlinkTarget_Navigate(target, grfHLNF, This->Location);
IHlinkTarget_Release(target);
}
else
{
static const WCHAR szOpen[] = {'o','p','e','n',0};
LPWSTR target = NULL;
r = IHlink_GetStringReference(iface, HLINKGETREF_DEFAULT, &target, NULL);
if (SUCCEEDED(r) && target)
{
ShellExecuteW(NULL, szOpen, target, NULL, NULL, SW_SHOW);
CoTaskMemFree(target);
}
}
RevokeBindStatusCallback(bcxt, pbsc);
IBindCtx_Release(bcxt);
IMoniker_Release(mon);
}
if (This->Site)
IHlinkSite_OnNavigationComplete(This->Site, This->SiteData, 0, r, NULL);
TRACE("Finished Navigation\n");
return r;
}
示例7: ClassMonikerROTData_Release
/***********************************************************************
* ClassMonikerIROTData_Release
*/
static ULONG WINAPI ClassMonikerROTData_Release(IROTData* iface)
{
ClassMoniker *This = impl_from_IROTData(iface);
TRACE("(%p)\n",iface);
return IMoniker_Release(&This->IMoniker_iface);
}
示例8: set_current_mon
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
{
IUriContainer *uri_container;
IUri *uri = NULL;
HRESULT hres;
if(This->mon) {
if(This->doc_obj && !(flags & (BINDING_REPLACE|BINDING_REFRESH))) {
if(This == This->doc_obj->basedoc.window)
notify_travellog_update(This->doc_obj);
else
TRACE("Skipping travellog update for frame navigation.\n");
}
IMoniker_Release(This->mon);
This->mon = NULL;
}
This->load_flags = flags;
if(!mon)
return;
IMoniker_AddRef(mon);
This->mon = mon;
hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
if(SUCCEEDED(hres)) {
hres = IUriContainer_GetIUri(uri_container, &uri);
IUriContainer_Release(uri_container);
if(hres != S_OK) {
WARN("GetIUri failed: %08x\n", hres);
uri = NULL;
}
}
if(!uri) {
WCHAR *url;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
if(SUCCEEDED(hres)) {
hres = create_uri(url, 0, &uri);
if(FAILED(hres)) {
WARN("CrateUri failed: %08x\n", hres);
set_current_uri(This, NULL);
This->url = SysAllocString(url);
CoTaskMemFree(url);
return;
}
CoTaskMemFree(url);
}else {
WARN("GetDisplayName failed: %08x\n", hres);
}
}
set_current_uri(This, uri);
if(uri)
IUri_Release(uri);
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
示例9: ItemMonikerImpl_GetTimeOfLastChange
/******************************************************************************
* ItemMoniker_GetTimeOfLastChange
******************************************************************************/
static HRESULT WINAPI ItemMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
IBindCtx* pbc,
IMoniker* pmkToLeft,
FILETIME* pItemTime)
{
IRunningObjectTable* rot;
HRESULT res;
IMoniker *compositeMk;
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pItemTime);
if (pItemTime==NULL)
return E_INVALIDARG;
/* If pmkToLeft is NULL, this method returns MK_E_NOTBINDABLE */
if (pmkToLeft==NULL)
return MK_E_NOTBINDABLE;
else {
/* Otherwise, the method creates a composite of pmkToLeft and this moniker and uses the ROT to access */
/* the time of last change. If the object is not in the ROT, the method calls */
/* IMoniker::GetTimeOfLastChange on the pmkToLeft parameter. */
res=CreateGenericComposite(pmkToLeft,iface,&compositeMk);
if (FAILED(res))
return res;
res=IBindCtx_GetRunningObjectTable(pbc,&rot);
if (FAILED(res)) {
IMoniker_Release(compositeMk);
return res;
}
if (IRunningObjectTable_GetTimeOfLastChange(rot,compositeMk,pItemTime)!=S_OK)
res=IMoniker_GetTimeOfLastChange(pmkToLeft,pbc,NULL,pItemTime);
IMoniker_Release(compositeMk);
}
return res;
}
示例10: enum_find_filter
/* Helper function, checks if filter with given name was enumerated. */
static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
{
IMoniker *pMoniker = NULL;
BOOL found = FALSE;
ULONG nb;
HRESULT hr;
static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
while(!found && IEnumMoniker_Next(pEnum, 1, &pMoniker, &nb) == S_OK)
{
IPropertyBag * pPropBagCat = NULL;
VARIANT var;
VariantInit(&var);
hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
ok(SUCCEEDED(hr), "IMoniker_BindToStorage failed with %x\n", hr);
if (FAILED(hr) || !pPropBagCat)
{
VariantClear(&var);
IMoniker_Release(pMoniker);
continue;
}
hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, &var, NULL);
ok(SUCCEEDED(hr), "IPropertyBag_Read failed with %x\n", hr);
if (SUCCEEDED(hr))
{
CHAR val1[512], val2[512];
WideCharToMultiByte(CP_ACP, 0, V_BSTR(&var), -1, val1, sizeof(val1), 0, 0);
WideCharToMultiByte(CP_ACP, 0, wszFilterName, -1, val2, sizeof(val2), 0, 0);
if (!lstrcmpA(val1, val2)) found = TRUE;
}
IPropertyBag_Release(pPropBagCat);
IMoniker_Release(pMoniker);
VariantClear(&var);
}
return found;
}
示例11: GetActiveObject
/***********************************************************************
* GetActiveObject (OLEAUT32.35)
*
* Gets an object from the global item table.
*
* PARAMS
* rcid [I] CLSID of the object.
* preserved [I] Reserved. Set to NULL.
* ppunk [O] Address to store object into.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
{
WCHAR guidbuf[80];
HRESULT ret;
LPRUNNINGOBJECTTABLE runobtable;
LPMONIKER moniker;
StringFromGUID2(rcid,guidbuf,39);
ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
if (FAILED(ret))
return ret;
ret = GetRunningObjectTable(0,&runobtable);
if (FAILED(ret)) {
IMoniker_Release(moniker);
return ret;
}
ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
IRunningObjectTable_Release(runobtable);
IMoniker_Release(moniker);
return ret;
}
示例12: set_current_mon
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon)
{
IUriContainer *uri_container;
IUri *uri = NULL;
HRESULT hres;
if(This->mon) {
if(This->doc_obj)
notify_travellog_update(This->doc_obj);
IMoniker_Release(This->mon);
This->mon = NULL;
}
if(!mon)
return;
IMoniker_AddRef(mon);
This->mon = mon;
hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
if(SUCCEEDED(hres)) {
hres = IUriContainer_GetIUri(uri_container, &uri);
IUriContainer_Release(uri_container);
if(hres != S_OK) {
WARN("GetIUri failed: %08x\n", hres);
uri = NULL;
}
}
if(!uri) {
WCHAR *url;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
if(SUCCEEDED(hres)) {
hres = CreateUri(url, 0, 0, &uri);
if(FAILED(hres)) {
WARN("CrateUri failed: %08x\n", hres);
set_current_uri(This, NULL);
This->url = SysAllocString(url);
CoTaskMemFree(url);
return;
}
CoTaskMemFree(url);
}else {
WARN("GetDisplayName failed: %08x\n", hres);
}
}
set_current_uri(This, uri);
if(uri)
IUri_Release(uri);
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
示例13: XMLView_Moniker_Release
static ULONG WINAPI XMLView_Moniker_Release(IMoniker *iface)
{
Moniker *This = impl_from_IMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
if(!ref) {
IMoniker_Release(This->mon);
heap_free(This);
}
return ref;
}
示例14: RegisterActiveObject
/***********************************************************************
* RegisterActiveObject (OLEAUT32.33)
*
* Registers an object in the global item table.
*
* PARAMS
* punk [I] Object to register.
* rcid [I] CLSID of the object.
* dwFlags [I] Flags.
* pdwRegister [O] Address to store cookie of object registration in.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI RegisterActiveObject(
LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
) {
WCHAR guidbuf[80];
HRESULT ret;
LPRUNNINGOBJECTTABLE runobtable;
LPMONIKER moniker;
StringFromGUID2(rcid,guidbuf,39);
ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
if (FAILED(ret))
return ret;
ret = GetRunningObjectTable(0,&runobtable);
if (FAILED(ret)) {
IMoniker_Release(moniker);
return ret;
}
ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
IRunningObjectTable_Release(runobtable);
IMoniker_Release(moniker);
return ret;
}
示例15: bind_to_object
static HRESULT bind_to_object(DocHost *This, IMoniker *mon, LPCWSTR url, IBindCtx *bindctx,
IBindStatusCallback *callback)
{
WCHAR schema[30];
DWORD schema_len;
HRESULT hres;
static const WCHAR httpW[] = {'h','t','t','p',0};
static const WCHAR httpsW[] = {'h','t','t','p','s',0};
static const WCHAR ftpW[]= {'f','t','p',0};
if(mon) {
IMoniker_AddRef(mon);
}else {
hres = create_moniker(url, &mon);
if(FAILED(hres))
return hres;
}
CoTaskMemFree(This->url);
hres = IMoniker_GetDisplayName(mon, 0, NULL, &This->url);
if(FAILED(hres))
FIXME("GetDisplayName failed: %08x\n", hres);
IBindCtx_RegisterObjectParam(bindctx, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM,
(IUnknown*)CLIENTSITE(This));
hres = CoInternetParseUrl(This->url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
&schema_len, 0);
if(SUCCEEDED(hres) &&
(!strcmpW(schema, httpW) || !strcmpW(schema, httpsW) || !strcmpW(schema, ftpW))) {
hres = http_load_hack(This, mon, callback, bindctx);
}else {
IUnknown *unk = NULL;
hres = IMoniker_BindToObject(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
if(SUCCEEDED(hres)) {
hres = S_OK;
if(unk)
IUnknown_Release(unk);
}else if(try_application_url(url)) {
hres = S_OK;
}else {
FIXME("BindToObject failed: %08x\n", hres);
}
}
IMoniker_Release(mon);
return S_OK;
}