HRESULT CIETabProcControl::Invoke(DISPID dispidMember, const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexecpinfo, UINT *puArgErr)
{
	HRESULT hr = S_OK;
	
	switch(dispidMember)
	{
        case DISPID_TITLECHANGE:
            {
                CComBSTR bstrTitle(pdispparams->rgvarg[0].bstrVal);
                if (NULL != bstrTitle && NULL != m_spWebBrowser)
                {
                    CComQIPtr<IHTMLDocument2> spDoc2;
                    CComPtr<IDispatch> spDisp;
                    m_spWebBrowser->get_Document(&spDisp);
                    if (spDisp && NULL != (spDoc2 = spDisp))
                    {
                        spDoc2->put_title(bstrTitle);
                    }
                }
            }
            break;

		case DISPID_ONQUIT:
        	hr = m_spCP->Unadvise(m_dwCookie);
			break;

		default:
            hr = __super::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexecpinfo, puArgErr);
			break;
	}
	
	return hr;
}
示例#2
0
STDMETHODIMP CCoAutoRun::get_Title(BSTR* title)
{
	TCHAR szTitle[255] = {0};
	::GetWindowText(hWndMainFrame, szTitle, 255);
	CComBSTR bstrTitle(szTitle);
	*title = bstrTitle.Detach();
	return S_OK;
}
void 
CContextSamplePropPage::MessageBox( UINT id )
{
    CComBSTR bstrMessage;
    CComBSTR bstrTitle( "Windows Media Services" );

    if( bstrMessage.LoadString( id ) )
    {
        ::MessageBox( m_hWnd, bstrMessage, bstrTitle, MB_OK );
    }
}