Exemplo n.º 1
0
//----------------------------------------------------------------------------
//  Cleanup
HRESULT CAnchoRuntime::Cleanup()
{
  AtlUnadvise(m_pWebBrowser, DIID_DWebBrowserEvents2, m_WebBrowserEventsCookie);
  AtlUnadvise(m_pBrowserEventSource, IID_DAnchoBrowserEvents, m_AnchoBrowserEventsCookie);

  gWindowDocumentMap.eraseTab(m_TabID);
  return S_OK;
}
Exemplo n.º 2
0
// --------------------------------------------------------------------------------------------
// TRiASNotificationSink und TRiASSysNotificationSink bei TRiAS wieder abmelden
HRESULT CNewArea::DisconnectFromServer (void)
{
// künstliches AddRef, da uns nachfolgendes AtlUnadvise freigeben kann
WUnknown Unk ((IEditOperation*)this);

    AtlUnadvise (m_Site, IID_ITRiASNotificationSink, m_dwCookieN); 
    AtlUnadvise (m_Site, IID_ITRiASSysNotificationSink, m_dwCookieSN); 
    
    m_Site.Assign (NULL);		// freigeben von TRiAS
    m_dwCookieN = 0L;
    m_dwCookieSN = 0L;
    return S_OK;

} // DisconnectFromServer
	void BrowserControlPane::Dispose(void)
	{
		this->keyHandling = kIgnore;
		this->mouseHandling = kIgnore;

		if (this->pBrowser != NULL)
		{
			HRESULT	err;

			err = AtlUnadvise(this->pBrowser, DIID_DWebBrowserEvents2, this->connCookie);
			ASSERT(SUCCEEDED(err));
		}

		if (this->pBrowser != NULL)
		{
			this->pBrowser->Stop();
			this->pBrowser->Quit();
			this->pBrowser.Release();
		}

		if (this->hwnd != NULL)
		{
			::DestroyWindow(this->hwnd);
			this->hwnd = NULL;
			::SetFocus(hparentwnd);
		}
	}
Exemplo n.º 4
0
STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite )
{
    HRESULT hr = IOleObjectImpl<CSOActiveX>::SetClientSite( aClientSite );

    if( !aClientSite )
    {
        ATLASSERT( mWebBrowser2 );
        if( mWebBrowser2 )
            AtlUnadvise( mWebBrowser2, DIID_DWebBrowserEvents2, mCookie );
        return hr;
    }

    CComPtr<IOleContainer> aContainer;
    m_spClientSite->GetContainer( &aContainer );
    ATLASSERT( aContainer );

    if( SUCCEEDED( hr )  && aContainer )
    {
        CComQIPtr<IServiceProvider, &IID_IServiceProvider> aServiceProvider( aContainer );
        ATLASSERT( aServiceProvider );

        if( aServiceProvider )
        {
            aServiceProvider->QueryService( SID_SInternetExplorer,
                                            IID_IWebBrowser,
                                            (void**)&mWebBrowser2 );
            ATLASSERT( mWebBrowser2 );
            if( mWebBrowser2 )
                AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie );
        }
    }

    return hr;
}
Exemplo n.º 5
0
STDMETHODIMP CDebugFormManager::OnShutdown()
{
	RETURN_IF_FAILED(AtlUnadvise(m_pViewDebugEngineService, IID_IViewDebugEngineServiceEvents, m_dwCookie));
	m_pServiceProvider = NULL;

	return S_OK;
}
Exemplo n.º 6
0
STDMETHODIMP CTimelineLoadingService::OnShutdown()
{
	if (m_pThreadServiceShowMoreService)
	{
		RETURN_IF_FAILED(AtlUnadvise(m_pThreadServiceShowMoreService, __uuidof(IThreadServiceEventSink), m_dwAdviceThreadServiceShowMoreService));
	}
	RETURN_IF_FAILED(AtlUnadvise(m_pThreadServiceUpdateService, __uuidof(IThreadServiceEventSink), m_dwAdviceThreadServiceUpdateService));
	RETURN_IF_FAILED(IInitializeWithControlImpl::OnShutdown());

	m_pThreadServiceUpdateService.Release();
	m_pTimelineControl.Release();
	m_pThreadServiceShowMoreService.Release();;
	m_pServiceProvider.Release();

	return S_OK;
}
Exemplo n.º 7
0
STDMETHODIMP CTimelineCleanupService::OnShutdown()
{
	RETURN_IF_FAILED(m_pTimerServiceCleanup->StopTimer());
	RETURN_IF_FAILED(AtlUnadvise(m_pTimerServiceCleanup, __uuidof(ITimerServiceEventSink), m_dwAdviceTimerServiceCleanup));
	m_pTimerServiceCleanup.Release();
	return S_OK;
}
Exemplo n.º 8
0
STDMETHODIMP CUpdateIssueService::OnShutdown()
{
	RETURN_IF_FAILED(AtlUnadvise(m_pThreadService, __uuidof(IThreadServiceEventSink), m_dwAdvice));
	m_pSettings.Release();
	m_pThreadService.Release();
	m_pTimerService.Release();
	return S_OK;
}
Exemplo n.º 9
0
// Unsubscribe event sink from the control
HRESULT CControlSite::Unadvise(const IID &iid, DWORD dwCookie)
{
    if (m_spObject == NULL)
    {
        return E_UNEXPECTED;
    }

    return AtlUnadvise(m_spObject, iid, dwCookie);
}
Exemplo n.º 10
0
STDMETHODIMP CManagedDebugSessionService::OnShutdown()
{
    if (m_dwAdvice)
    {
        RETURN_IF_FAILED(AtlUnadvise(m_pDebugSessionService, IID_IDebugSessionServiceEvents, m_dwAdvice));
        m_dwAdvice = 0;
    }
    return S_OK;
}
Exemplo n.º 11
0
HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
{
    CComPtr<IBrowserService>                browserService;
    CComPtr<IOleWindow>                     oleWindow;
    CComPtr<IServiceProvider>               serviceProvider;
    CComPtr<IProfferService>                profferService;
    HWND                                    parentWindow;
    HWND                                    hwnd;
    HRESULT                                 hResult;

    fSite.Release();
    if (pUnkSite == NULL)
    {
        hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie);
        // TODO: revoke brand band service
        return S_OK;
    }

    // get window handle of parent
    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
    if (FAILED_UNEXPECTEDLY(hResult))
        return hResult;
    parentWindow = NULL;
    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
    if (SUCCEEDED(hResult))
        hResult = oleWindow->GetWindow(&parentWindow);
    if (!::IsWindow(parentWindow))
        return E_FAIL;

    // create worker window in parent window
    hwnd = SHCreateWorkerWindowW(0, parentWindow, 0,
        WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0);
    if (hwnd == NULL)
        return E_FAIL;
    SubclassWindow(hwnd);

    // take advice to watch events
    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
    if (SUCCEEDED(hResult))
    {
        hResult = serviceProvider->QueryService(
            SID_SBrandBand, IID_PPV_ARG(IProfferService, &profferService));
        if (SUCCEEDED(hResult))
            hResult = profferService->ProfferService(SID_SBrandBand,
                static_cast<IServiceProvider *>(this), &fProfferCookie);
        hResult = serviceProvider->QueryService(SID_SShellBrowser,
            IID_PPV_ARG(IBrowserService, &browserService));
        if (SUCCEEDED(hResult))
            hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
    }

    // ignore any hResult errors up to here - they are nonfatal
    hResult = S_OK;
    SelectImage();
    return hResult;
}
Exemplo n.º 12
0
HRESULT DWebBrowserEventsImpl::Disconnect()
{
	HRESULT hr = S_OK;
	if (!m_spWebBrowser)
		return hr;

	hr = AtlUnadvise(m_spWebBrowser, __uuidof(DWebBrowserEvents2), m_dwCookie);
	m_dwCookie = 0;
	return hr; 
}
Exemplo n.º 13
0
BOOL CMDriveDlg::Unadvise()
{
	if (m_nAdviseCnt > 0)
	{
		HRESULT hRes = AtlUnadvise(pRandom, IID_IRandomEvent, m_arrAdvise[--m_nAdviseCnt]);
		return (SUCCEEDED(hRes));
	}
	else
		return FALSE;
}
Exemplo n.º 14
0
void CImpCEDL::DestroyEvntSink(void)
{
    if(m_pEvents) {
        HRESULT hr = AtlUnadvise(GetUnknown(),IID_IDLEvents, m_dwEvents);
        
        m_pEvents->Release();
        m_pEvents = NULL;            
    }

}
Exemplo n.º 15
0
void CGNetUpdater::Cleanup()
{
	if(m_pMasterServer)
	{
		if(m_dwMasterServerCookie)
		{
			AtlUnadvise(m_pMasterServer, IID_IRemoteMasterServerEvents, m_dwMasterServerCookie);
			m_dwMasterServerCookie = NULL;
		}

		if(m_dwMasterServerCookie2)
		{
			AtlUnadvise(m_pMasterServer, IID_IGameEvents, m_dwMasterServerCookie2);
			m_dwMasterServerCookie2 = NULL;
		}

		m_pMasterServer.Release();
	}
}
Exemplo n.º 16
0
STDMETHODIMP CDeviceControl::Close()
{
    if(!manager)
        return E_FAIL;

    AtlUnadvise(manager,__uuidof(_IDeviceEvents),cookie);
    manager.Release();
    cookie = 0;
    return S_OK;
}
Exemplo n.º 17
0
Arquivo: atl.c Projeto: ErikBjare/wine
static void test_cp(void)
{
    DWORD cookie = 0;
    HRESULT hres;

    hres = AtlAdvise(NULL, (IUnknown*)0xdeed0000, &CLSID_Test, &cookie);
    ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);

    hres = AtlUnadvise(NULL, &CLSID_Test, 0xdeadbeef);
    ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);

    hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
    ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
    ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
    ok(advise_cnt == 1, "advise_cnt = %d\n", advise_cnt);

    hres = AtlUnadvise((IUnknown*)&ConnectionPointContainer, &CLSID_Test, 0xdeadbeef);
    ok(hres == S_OK, "AtlUnadvise failed: %08x\n", hres);
    ok(!advise_cnt, "advise_cnt = %d\n", advise_cnt);
}
Exemplo n.º 18
0
HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *pOwner)
{
    if (!pOwner)
    {
        CComPtr<IBrowserService> browserService;
        HRESULT hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
        if (SUCCEEDED(hResult))
            AtlUnadvise(browserService, DIID_DWebBrowserEvents, fAdviseCookie);
        fSite = NULL; 
    }
    // connect to browser connection point
    return 0;
}
bool CEventHandler::UnhookEvent(IUnknown* pSource)
{
#if defined(__USE_ADDBACK_DUAL)
    AtlUnadvise(pSource, __uuidof(IAddBackEvents), cookie_);
#elif defined(__USE_ADDBACK_DISPATCH)
    DispEventUnadvise(pSource, &__uuidof(_IAddBackEvents));
#elif defined(__USE_ADDBACK_BYATTRIB_DISPATCH)
    __unhook(&_IAddBackEvents::ChangedAddEnd, pSource, &CEventHandler::onChangedAddEnd);
    __unhook(&_IAddBackEvents::ChangedSum, pSource, &CEventHandler::onChangedSum);
#endif

    return true;
}
Exemplo n.º 20
0
CUSBSimEndpoint::~CUSBSimEndpoint (void)
{
    if (m_Pipe) {
        usbsim_pipe_delete (m_Pipe);
    }
    if (m_pEvents) {
        AtlUnadvise (m_pSoftUSBEndpoint, __uuidof (ISoftUSBEndpointEvents),
                     m_dwCookie);
        m_pEvents->Release ();
    }
    if (m_pSoftUSBEndpoint) {
        m_pSoftUSBEndpoint->Release ();
    }
}
Exemplo n.º 21
0
CJSProxyObj::~CJSProxyObj()
{
	if (m_pDisp && m_dwCookie != 0xFEFEFEFE)
	{
		HRESULT hr = AtlUnadvise(m_pDisp, m_EventIID, m_dwCookie);

		m_pDisp = nullptr;
		m_dwCookie = 0xFEFEFEFE;
	}
	if (m_pEventObj)
		delete m_pEventObj;
	for (int i = 0; i < m_mapDispId.GetSize(); i++)
		SysFreeString(m_mapDispId.GetValueAt(i));
}
Exemplo n.º 22
0
STDMETHODIMP CLogFormView::OnClose()
{
	CComQIPtr<IServiceProvider> pServiceProvider =  m_pControl;
	if(!pServiceProvider)
		return E_NOINTERFACE;

	if(m_dwAdvice)
	{
		RETURN_IF_FAILED(AtlUnadvise(m_pViewDebugEngineService, IID_IViewDebugEngineServiceEvents, m_dwAdvice));
		m_dwAdvice = 0;
	}

	CComPtr<IDebugSession> pDebugSession = NULL;
	GetDebugSession(&pDebugSession);
	if(pDebugSession)
		pDebugSession->RemoveOutputCallback(this);

	return S_OK;
}
Exemplo n.º 23
0
//----------------------------------------------------------------------------
//  
void CAnchoBackgroundAPI::UnInit()
{
  if (m_BackgroundWindow)
  {
    m_BackgroundWindow->DestroyWindow();
    m_BackgroundWindow.Release();
  }
  if (m_LogWindow)
  {
    m_LogWindow->DestroyWindow();
    m_LogWindow.Release();
  }
  if (m_Magpie)
  {
    if (m_dwMagpieSinkCookie)
    {
      AtlUnadvise(m_Magpie, DIID__IMagpieLoggerEvents, m_dwMagpieSinkCookie);
      m_dwMagpieSinkCookie = 0;
    }
    m_Magpie->Shutdown();
    m_Magpie.Release();
  }
}
Exemplo n.º 24
0
//------------------------------------------------------------------*
HRESULT CFCMessageSessionThread::DoDisconnect()
{
    HRESULT hr;

    if (m_pMessage != NULL) {

        TrcPrint(TRC_INTERFACE, _T("MsgSession: DoDisconnect(%s)\n"),(LPCTSTR) m_pRawMsgSession->m_strMachineName);

        hr = m_pMessage->Disconnect(m_lKey);

        if (m_dwMsgNotifyCookie != 0UL) {
            hr = AtlUnadvise(m_pMessage, IID__ICERemoteMessageEvent, m_dwMsgNotifyCookie);
        }
        m_dwMsgNotifyCookie = 0;

        Logout();

        FC_RELEASE_PTR(m_pCheckConnection);
        FC_RELEASE_PTR(m_pMessage);
        CoDisconnectObject(this, 0);
    }
    return S_OK;
}
	BrowserControlPane::BrowserControlPane(HWND hpwnd, HINSTANCE hInstance, RECT* ipBoundRect)
		: hparentwnd(hpwnd)
		// 콘트롤 폐인 없음... : ControlPane( ipBoundRect )
	{
		HRESULT					err;
		RECT					bounds;
		TCHAR*					sClassName = TEXT("NexonADBrowser");
		WNDCLASS				windowClass;
		CComPtr< IOleObject >	pOleObject;
		RECT					clientRECT;

		ASSERT(ipBoundRect != NULL);

		this->isActivated = TRUE;
		this->allowNewWindow = TRUE;
		this->showScrollBar = FALSE;
		this->sLimitToInside[0] = 0;
		this->timeout = kInitialTimeout;
		this->keyHandling = kHandleAndDontPass;
		this->mouseHandling = kHandleAndDontPass;
		// this->initialLoading = TRUE;
		this->initialLoading = FALSE;

		bounds = *ipBoundRect;

		// create window

		windowClass.style = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW | CS_DBLCLKS | CS_OWNDC;
		windowClass.lpfnWndProc = (WNDPROC)BrowserControlPane::WindowProcEntry;
		windowClass.cbClsExtra = 0;
		windowClass.cbWndExtra = 0;
		windowClass.hInstance = hInstance;
		windowClass.hIcon = NULL;
		windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
		windowClass.hbrBackground = (HBRUSH) ::GetStockObject(BLACK_BRUSH);
		windowClass.lpszMenuName = NULL;
		windowClass.lpszClassName = sClassName;
		RegisterClass(&windowClass);

		ASSERT(s_pInCreation == NULL);
		s_pInCreation = this;
		this->hwnd = CreateWindowEx(0, sClassName, _T(""), WS_CHILD | WS_CLIPSIBLINGS,
			bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top,
			hparentwnd, (HMENU)NULL, hInstance, (LPVOID)NULL);
		::SetWindowLongA(this->hwnd, GWL_USERDATA, (DWORD) this);
		s_pInCreation = NULL;

		// create WebBrowser control
		err = ::CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IOleObject, (void**)&pOleObject);
		ASSERT(SUCCEEDED(err));
		if (SUCCEEDED(err))
		{
			err = pOleObject->SetClientSite(this);
			ASSERT(SUCCEEDED(err));
		}

		// in-place actvivate the control
		if (SUCCEEDED(err))
		{
			::SetRect(&clientRECT, 0, 0, bounds.right - bounds.left, bounds.bottom - bounds.top);
			err = pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, this, 0, this->hwnd, &clientRECT);
			ASSERT(SUCCEEDED(err));
		}

		// get the browser control pointer
		if (SUCCEEDED(err))
		{
			this->pBrowser = pOleObject;
			ASSERT(this->pBrowser != NULL);
		}

		// setup connection for events
		if (SUCCEEDED(err))
		{
			err = AtlAdvise(this->pBrowser, (IOleClientSite*) this, DIID_DWebBrowserEvents2, &this->connCookie);
			ASSERT(SUCCEEDED(err));
		}

		// set size
		if (SUCCEEDED(err))
		{
			CComQIPtr<IOleInPlaceObject, &IID_IOleInPlaceObject>	pInPlaceObject(this->pBrowser);

			ASSERT(pInPlaceObject != NULL);
			err = pInPlaceObject->SetObjectRects(&clientRECT, &clientRECT);
			ASSERT(SUCCEEDED(err));
		}

		if (FAILED(err))
		{
			if (this->pBrowser != NULL)
			{
				err = AtlUnadvise(this->pBrowser, DIID_DWebBrowserEvents2, this->connCookie);
				ASSERT(SUCCEEDED(err));
			}

			this->pBrowser.Release();
			::OleUninitialize();
			::DestroyWindow(this->hwnd);
			this->hwnd = NULL;
		}
	}