void CMDriveDlg::OnOK() { OnStopAll(); while (Unadvise()) ; ::ReleaseDC(GetDlgItem(IDC_PICTURE)->m_hWnd, hDrawDC); CDialog::OnOK(); }
static HRESULT STDMETHODCALLTYPE MyUnadvise (IReferenceClock* pThis, DWORD dwAdviseCookie) { debuglog(LCF_TIMERS, __FUNCTION__ " called.\n"); //return Unadvise(pThis, dwAdviseCookie); if(TIMERR_NOERROR == MytimeKillEvent((UINT)dwAdviseCookie)) return S_OK; //return S_FALSE; return Unadvise(pThis, dwAdviseCookie); // because AdvisePeriodic still does passthrough }
static HRESULT STDMETHODCALLTYPE MyUnadvise(IReferenceClock* pThis, DWORD dwAdviseCookie) { ENTER(); //return Unadvise(pThis, dwAdviseCookie); if (TIMERR_NOERROR == MytimeKillEvent((UINT)dwAdviseCookie)) return S_OK; //return S_FALSE; return Unadvise(pThis, dwAdviseCookie); // because AdvisePeriodic still does passthrough }
void CWebWindow::OnDestroy() { Unadvise(); m_MpaWebEvent.m_pParent = NULL; ////////////////////////////////////////////////////////////////////////// // Rem: [4/22/2002] ќб¤зательно очищать перед WEB_WINDOW_PARENT::OnDestroy(); // иначе не будет удал¤тьм¤ объект m_InWindowDropTarget ////////////////////////////////////////////////////////////////////////// if(m_InWindowDropTarget) { m_InWindowDropTarget->Revoke(); m_InWindowDropTarget->ExternalRelease(); } ////////////////////////////////////////////////////////////////////////// WEB_WINDOW_PARENT::OnDestroy(); }
STDMETHODIMP CDispEventTransfer::detachEvent( VARIANT_BOOL* pRetVal ) { if( pRetVal ) *pRetVal = VARIANT_FALSE; if( !m_spSource || !m_bstrEvent || DISPID_UNKNOWN == m_idMember ) return S_FALSE; HRESULT hr = Unadvise( m_spSource ); if( FAILED(hr) ) return S_FALSE; m_spSource.Release(); m_bstrEvent.Empty(); m_idMember = DISPID_UNKNOWN; hr = m_vNotify.Clear(); ATLASSERT( SUCCEEDED(hr) ); hr = m_vListener.Clear(); ATLASSERT( SUCCEEDED(hr) ); if( pRetVal ) *pRetVal = VARIANT_TRUE; return S_OK; }
status_t BnChatSession::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { status_t result = 0x80000000; _TRACE("ChatSession::onTransact[pid:%d] >>:code 0x%x",GetCallerPID(),code); //data.print(); switch(code) { case ICS_getName: { CHECK_INTERFACE(IChatSession, data, reply); //CHECKOUT_CALLER(data); String16 name = const_cast<BnChatSession*>(this)->GetName(); reply->writeString16(name); result = NO_ERROR; } break; case ICS_GetStatements: { CHECK_INTERFACE(IChatSession, data, reply); //CHECKOUT_CALLER(data); Vector<String16> list = GetStatements(); const size_t N = list.size(); reply->writeInt32(N); _TRACE("GetStatements num %u",(unsigned int)N); for (size_t i=0; i<N; i++) { reply->writeString16(list[i]); } result = NO_ERROR; } break; case ICS_Say: { CHECK_INTERFACE(IChatSession, data, reply); //CHECKOUT_CALLER(data); String16 statement = data.readString16(); status_t err = Say(statement); reply->writeInt32(err); result = NO_ERROR; } break; case ICS_AsyncSay: { CHECK_INTERFACE(IChatSession, data, reply); //CHECKOUT_CALLER(data); String16 statement = data.readString16(); AsyncSay(statement); result = NO_ERROR; } break; case ICS_Advise: { CHECK_INTERFACE(IChatSession, data, reply); sp<IChatSessionEvents> eventSink = interface_cast<IChatSessionEvents>(data.readStrongBinder()); Advise(eventSink); result = NO_ERROR; } break; case ICS_Unadvise: { CHECK_INTERFACE(IChatSession, data, reply); //CHECKOUT_CALLER(data); status_t err = Unadvise(); reply->writeInt32(err); result = NO_ERROR; } break; default: result = BBinder::onTransact(code, data, reply, flags); } _TRACE("ChatSession::onTransact[pid:%d] <<:result %d",GetCallerPID(),result); //reply.print(); return result; }
void CMDriveDlg::OnUnadvise() { if (!Unadvise()) AfxMessageBox("Unadvise failed"); }