コード例 #1
0
HRESULT SourceEventListener::Initialize(_In_ DWORD dispatchThreadId, _In_ SourceController* pSourceController, _In_ ULONG ownerId, _In_ IDebugApplicationNode* pDebugApplicationNode, _In_opt_ IDebugDocumentText* pDebugDocumentText)
{
    ATLENSURE_RETURN_HR(ThreadHelpers::IsOnPDMThread(dispatchThreadId), E_UNEXPECTED);
    ATLENSURE_RETURN_HR(pSourceController != nullptr, E_INVALIDARG);
    ATLENSURE_RETURN_HR(pDebugApplicationNode != nullptr, E_INVALIDARG);

    m_dispatchThreadId = dispatchThreadId;
    m_spSourceController = pSourceController;
    m_ownerId = ownerId;
    m_spDebugApplicationNode = pDebugApplicationNode;
    m_spDebugDocumentText = pDebugDocumentText;

    // Connect node event sink
    HRESULT hr = ATL::AtlAdvise(m_spDebugApplicationNode, GetUnknown(), IID_IDebugApplicationNodeEvents, &m_dwNodeCookie);
    m_advisedNodeEvents = (hr == S_OK);

    // Not all nodes have the IDebugDocumentText interface, depending on the host that is managing it.
    // We only want to sink text events if this interface exists, otherwise we can just safely ignore it.
    if (m_spDebugDocumentText.p != nullptr)
    {
        hr = ATL::AtlAdvise(m_spDebugDocumentText, GetUnknown(), IID_IDebugDocumentTextEvents, &m_dwTextCookie);
        m_advisedTextEvents = (hr == S_OK);
    }

    return S_OK;
}
コード例 #2
0
LRESULT CDTDViewGroup::OnMDIActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    HWND hwndChildDeact = (HWND) wParam;        // child being deactivated
    HWND hwndChildAct = (HWND) lParam;          // child being activated

    HWND hwnd;
    get_hwnd(&hwnd);

    BOOL bActivate = (hwnd == hwndChildAct);

    CComQIPtr<IUIManager> uiManager = gIFrame;

    if (bActivate)
    {
        //CComPtr<IDocumentsClass> documentsClass;
        //m_pDocument->GetDocumentsClass(&documentsClass);

        uiManager->ActivateObject(NULL/*documentsClass*/, m_pDocument->GetUnknown());
        uiManager->ActivateObject(m_pDocument->GetUnknown(), GetUnknown());
//		uiManager->ActivateObject(m_viewGroup->GetUnknown(), GetUnknown());
    }

    CUIMDIChildImpl<CDTDViewGroup>::OnMDIActivate(uMsg, wParam, lParam, bHandled);

    if (!bActivate)
    {
//		uiManager->DeactivateObject(GetUnknown());
        uiManager->DeactivateObject(GetUnknown());
        uiManager->DeactivateObject(m_pDocument->GetUnknown());
    }

    return 0;
}
コード例 #3
0
// eine neue Objekteigenschaft soll erzeugt werden
STDMETHODIMP CFastdbFeatures::OnCreate (VARIANT Name, BSTR Type, FEATURETYPE rgType, ITRiASFeature **ppIFeat)
{
	CHECKOUTPOINTER(ppIFeat);

	USES_CONVERSION;
	COM_TRY {
	// jetzt wirklich erzeugen
	CIID ClsId (Type, CIID::INITCIID_InitFromProgId);

		if (!ClsId)	ClsId = CLSID_FastdbFeature;	// default ClsId

	WTRiASFeatures BaseFeats;
	WDispatch Parent;

		THROW_FAILED_HRESULT(m_BaseUnk -> QueryInterface (BaseFeats.ppi()));
		THROW_FAILED_HRESULT(BaseFeats -> get_Parent (Parent.ppi()));

	// Parent muß hier Objektklasse sein
	WTRiASObjects Objs;

		THROW_FAILED_HRESULT(Parent -> QueryInterface (Objs.ppi()));

	// neuen Satz erzeugen und zu der Objektklasse hinzufügen
	LONG lCursor (GetPropertyFrom (Objs, g_cbObjectsCursor, 0L));

		_ASSERTE(0 != lCursor);

	dbDatabase *pdb = GetRelatedDatabase(GetUnknown());
	dbCursor<CDBClass> cursor (pdb);
	CDBClass *pClass = cursor.at (dbReference<CDBClass>(oid_t(lCursor)));

		if (NULL == pClass || cursor.isEmpty())
			THROW_FAILED_HRESULT(FASTDB_E_OBJECTS_BADREFERENCE);

	CComVariant vVal;
	CDBFeatureDesc FDesc;

		THROW_FAILED_HRESULT(vVal.ChangeType (VT_BSTR, &Name));
	
		FDesc.m_pName = OLE2A(V_BSTR(&vVal));
		FDesc.m_rgType = rgType;
		FDesc.objclass = cursor.currentId();
	
	dbCursor<CDBFeatureDesc> featuredesc (GetRelatedDatabase(GetUnknown()));

		featuredesc.at (pdb -> insert (FDesc));
		THROW_FAILED_HRESULT(SetupFeature (ClsId, BaseFeats, featuredesc, Parent, ppIFeat));

	} COM_CATCH;
	return S_OK;
}
コード例 #4
0
ファイル: SOActiveX.cpp プロジェクト: CaoMomo/core
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;
}
コード例 #5
0
HRESULT CFastdbFeature::OnChangedName()
{
	USES_CONVERSION;
	COM_TRY {
	// neuen Namen vom Bezugsobjekt besorgen
	CComBSTR bstrName;
	WTRiASFeature BaseFeat;

		THROW_FAILED_HRESULT(m_BaseUnk -> QueryInterface (BaseFeat.ppi()));
		THROW_FAILED_HRESULT(BaseFeat -> get_Name(CLEARED(&bstrName)))

	// zugehöriges DB-Objekt referenzieren
	LONG lCursor (GetPropertyFrom (BaseFeat, g_cbFeatureCursor, 0L));

		if (0 != lCursor) {	// Objekt fertig initialisiert
		dbCursor<CDBFeatureDesc> cursor (GetRelatedDatabase(GetUnknown()), dbCursorForUpdate);
		CDBFeatureDesc *pFeatDesc = cursor.at (dbReference<CDBFeatureDesc>(oid_t(lCursor)));

			if (NULL == pFeatDesc || cursor.isEmpty())
				THROW_FAILED_HRESULT(FASTDB_E_FEATURE_BADREFERENCE);

			cursor -> m_pName = OLE2A(bstrName);
			cursor.update();
		}

	} COM_CATCH;
	return S_OK;
}
コード例 #6
0
LRESULT CPageDesignerApp::OnSetTool(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	m_activeTool = wID;

	switch (wID)
	{
	case ID_TOOL_SELECT:
	case ID_TOOL_DIRECT:
		m_activeSelectionTool = wID;
		break;

	case ID_TOOL_TWIRL:
	case ID_TOOL_BULGE:
		{
			if (wNotifyCode == BN_DBLCLK)
			{
				CPropertySheet* sheet = new CPropertySheet("Tool", 0, GetMainHwnd());

				CBrushDimensionsDlg	brush;
				brush.m_brushSettings = this;
				sheet->AddPage(brush);

				sheet->DoModal();
			}
		}
		break;
	}

	FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);

	return 0;
}
コード例 #7
0
STDMETHODIMP CPageDesignerApp::Run(long *result)
{
	CComObject<CPageDesignerFrame>::CreateInstance(&m_frame);
	m_frame->AddRef();

	gIFrame = m_frame;

	if (m_frame->CreateEx() == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	m_frame->ShowWindow(SW_SHOW/*nCmdShow*/);

	CComQIPtr<IUIManager> uiManager = m_frame;
/*
	CComPtr<IUnknown> pThis;
	QueryInterface(IID_IUnknown, (void**)&pThis);
*/
	uiManager->ActivateObject(NULL, GetUnknown());

	*result = 0;

	return S_OK;
}
コード例 #8
0
//------------------------------------------------------------------*
HRESULT CControlMgt::MessageThread()
{
    while (!m_bShutdownRequest) {
      BSTR lpNextMessage = NULL;
      CSingleLock lock(&m_csMessageQueue, TRUE);
      if (!m_qMessageQueue.IsEmpty())
          lpNextMessage = m_qMessageQueue.RemoveHead();
      lock.Unlock();
      if (lpNextMessage == NULL) {
          WaitForSingleObject(m_hWakeup, INFINITE);
      }
      else {
        HRESULT hr = Fire_OnNewMessage(lpNextMessage);
        SysFreeString(lpNextMessage);
        if (FAILED(hr)) {
            CoDisconnectObject(GetUnknown(), 0);
            return S_OK;//this usually deletes all references, so I can't touch this here any more...
        }
      }
    }

    CSingleLock lock(&m_csMessageQueue, TRUE);
    while (!m_qMessageQueue.IsEmpty()) {
        BSTR pDummy = m_qMessageQueue.RemoveHead();
        SysFreeString(pDummy);
    }
    return S_OK;
}
コード例 #9
0
ファイル: PROPACTB.CPP プロジェクト: hkaiser/TRiAS
///////////////////////////////////////////////////////////////////////////////
// IPropertyAction2 methods
STDMETHODIMP CPropertyAction::InitFromData (IDataObject *pIDO, BOOL fCreate, DWORD)
{
	if (NULL == pIDO) {
		if (fCreate)
			return S_OK;	// can attempt to initialize it self
		else
			return S_FALSE;	// can't attempt to replace internal data
	}

	COM_TRY {
	CComVariant vData;

		THROW_FAILED_HRESULT(GetVariantData (pIDO, &c_feInitPropAct, &vData));
		THROW_FAILED_HRESULT(vData.ChangeType(VT_BSTR));

	WParseStringPairs Bag (CLSID_ParseStringPairs);
	CComVariant v (DISP_E_PARAMNOTFOUND, VT_ERROR);	// no error log
	LONG lCount = 0;
	CComBSTR bstrData;

		if (*V_BSTR(&vData) != L';') 		// Data müssen mit ";PropActData" anfangen
			bstrData = L";PropActData;";

		bstrData += V_BSTR(&vData);

		THROW_FAILED_HRESULT(Bag -> put_Pattern (CComBSTR(L";%1=%2")));
		THROW_FAILED_HRESULT(Bag -> Parse (V_BSTR(&vData), &lCount));
		THROW_FAILED_HRESULT(Bag -> InitObject (GetUnknown(), v));

	} COM_CATCH;
	return S_OK;
}
コード例 #10
0
void CImpCEDL::CreateEvntSink(void) throw()
{

    if(m_pEvents) {//already an event interface created ?
        return; //yes, don't worry just use the existing one.
    }
    //initalize Event interface now
	HRESULT hr = CComObject<CImpDLEvents>::CreateInstance(&m_pEvents);
	if(FAILED(hr)) {
        ComThrow(GetObjectCLSID(),__uuidof(IDLEvents),hr);
	}

	m_pEvents->AddRef(); //stay with one reference

    hr = AtlAdvise(GetUnknown(),m_pEvents->GetUnknown(),
		IID_IDLEvents, &m_dwEvents);
	
    if(FAILED(hr)) {
		FC_DEBUGPRINT1(_T("CEDL> Advise failed hr=0x%x\n"),hr);
        m_dwEvents = 0;
		m_pEvents->Release();
        m_pEvents = NULL;
        ComThrow(GetObjectCLSID(),__uuidof(IDLEvents),hr);
	}

}
コード例 #11
0
// TODO, move this code into CPDObjectWrappableImpl
STDMETHODIMP CPDObjectFrame::put_textWrap(/*[in]*/ PDTextWrap newVal)
{
	if (m_textWrap != newVal)
	{
		m_textWrap = newVal;

		if (m_wrapPath)
		{
			CComQIPtr<INotifySend> cp = m_wrapPath;
			cp->Unadvise(this);
			m_wrapPath->Release();
			m_wrapPath = NULL;
		}

		m_editedWrapPath = FALSE;

		if (m_textWrap == TEXTWRAP_SHAPE || m_textWrap == TEXTWRAP_BBOX)
		{
			CComObject<CPDPath>::CreateInstance(&m_wrapPath);
			m_wrapPath->AddRef();

			RecreateWrapPath();

			CComQIPtr<INotifySend> cp = m_wrapPath;
			DWORD cookie;
			cp->Advise(this, &cookie);
		}

		// TODO notify ??
		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
	}

	return S_OK;
}
コード例 #12
0
HRESULT CWmp_scrobbler::SetCore(IWMPCore *pCore)
{
    HRESULT hr = S_OK;

    // release any existing WMP core interfaces
    ReleaseCore();

    // If we get passed a NULL core, this  means
    // that the plugin is being shutdown.

    if (pCore == NULL)
    {
        return S_OK;
    }

    m_spCore = pCore;

    // connect up the event interface
    CComPtr<IConnectionPointContainer>  spConnectionContainer;

    hr = m_spCore->QueryInterface( &spConnectionContainer );

    if (SUCCEEDED(hr))
    {
        hr = spConnectionContainer->FindConnectionPoint( __uuidof(IWMPEvents), &m_spConnectionPoint );
    }

    if (SUCCEEDED(hr))
    {
        hr = m_spConnectionPoint->Advise( GetUnknown(), &m_dwAdviseCookie );

        if ((FAILED(hr)) || (0 == m_dwAdviseCookie))
        {
            m_spConnectionPoint = NULL;
        }
    }

    m_wmpBootStrap.setParentHwnd( FindWindow( "WMPlayerApp", "Windows Media Player" ) );
    char filename[512];

	// Get the DLL filename etc
	GetModuleFileName( _Module.GetModuleInstance(), filename, sizeof( filename ) );
	CStdString Temp = filename;
	int pos = Temp.ReverseFind('\\');
	
	StartScrobbling( Temp.Left( pos + 1 ), _Module.GetModuleInstance() );
    
    if( m_wmpBootStrap.bootStrapRequired() )
    {
        m_wmpBootStrap.setCore( m_spCore );
        m_wmpBootStrap.setScrobSub( &m_Submitter );
        m_wmpBootStrap.setModuleHandle( _Module.GetModuleInstance() );
        m_wmpBootStrap.startBootStrap();
    }

    return hr;
}
コード例 #13
0
ファイル: chxmedpltfm.cpp プロジェクト: muromec/qtopia-ezx
STDMETHODIMP
CHXMediaPlatform::CreateInstance(REFCLSID   rclsid,
                                 void**     ppUnknown)
{
    IUnknown* pUnk = NULL;
    HX_RESULT nResult = ObjectFromCLSIDPrivate( rclsid, pUnk, NULL, GetUnknown() );

    *ppUnknown = pUnk;
    return nResult;
}
コード例 #14
0
STDMETHODIMP CPDLayer::put_name(BSTR newVal)
{
	if (wcscmp(m_name, newVal))
	{
		m_name = newVal;
		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
	}

	return S_OK;
}
コード例 #15
0
STDMETHODIMP CPDLayer::put_locked(VARIANT_BOOL newVal)
{
	if (m_locked != newVal)
	{
		m_locked = newVal;
		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
	}

	return S_OK;
}
コード例 #16
0
void CImpCEDL::DestroyEvntSink(void)
{
    if(m_pEvents) {
        HRESULT hr = AtlUnadvise(GetUnknown(),IID_IDLEvents, m_dwEvents);
        
        m_pEvents->Release();
        m_pEvents = NULL;            
    }

}
コード例 #17
0
STDMETHODIMP CPDLayer::put_color(OLE_COLOR newVal)
{
	if (m_color != newVal)
	{
		m_color = newVal;
		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
//		if (m_pDocument) m_pDocument->Fire_LayerOptionsChanged(this);
	}

	return S_OK;
}
コード例 #18
0
STDMETHODIMP CPDObjectSymbolInstance::setxy(double x, double y)
{
    m_x = x;
    m_y = y;

    CalculateBounds();

    FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);

    return S_OK;
}
コード例 #19
0
STDMETHODIMP CLHTMLActiveDocument::Show(ILXUIElement* element)
{
	/*
	{
		//CComPtr<IOleContainer> pContainer = NULL;
//		pClientSite->GetContainer(&pContainer);

		CComQIPtr<IServiceProvider> sp(m_spAddinSite);

		CComPtr<IWebBrowser> webBrowser;
		sp->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&webBrowser);
	}
	*/

	CComQIPtr<ILDOMDocumentView> documentView = /*m_pDocument->*/m_document;
	ATLASSERT(0);
#if 0
	documentView->createPresentation(&m_view);
#endif

	CComObject<CLHTMLWindow2>::CreateInstance(&m_pWindow);
	if (m_pWindow)
	{
		m_pWindow->AddRef();

		ATLASSERT(0);
#if 0
		m_pWindow->m_pAddin = this;

		m_pWindow->m_pCanvas->m_pSite = NULL;//this;

		m_pWindow->m_pCanvas->m_pView = static_cast<CHTMLDocumentView*>(m_view.p);
		m_pWindow->m_pCanvas->m_htmTree = m_pWindow->m_pCanvas->m_pView->m_pRootElement;
#endif
	}

	m_inplaceElement = element;

	CComQIPtr<ILDOMEventTarget>(m_inplaceElement)->addEventListener(L"mousedown", static_cast<ILDOMEventListener*>(this), VARIANT_FALSE/*bCapture*/);
	CComQIPtr<ILDOMEventTarget>(m_inplaceElement)->addEventListener(L"mouseup", static_cast<ILDOMEventListener*>(this), VARIANT_FALSE/*bCapture*/);
	CComQIPtr<ILDOMEventTarget>(m_inplaceElement)->addEventListener(L"mousemove", static_cast<ILDOMEventListener*>(this), VARIANT_FALSE/*bCapture*/);
	CComQIPtr<ILDOMEventTarget>(m_inplaceElement)->addEventListener(L"contextmenu", static_cast<ILDOMEventListener*>(this), VARIANT_FALSE/*bCapture*/);
	CComQIPtr<ILDOMEventTarget>(m_inplaceElement)->addEventListener(L"resize", static_cast<ILDOMEventListener*>(this), VARIANT_FALSE/*bCapture*/);

	ATLASSERT(0);
#if 0
	long cookie;
	element->addBehavior(NULL, &CComVariant(GetUnknown()), &cookie);
#endif

	OnPostVerbInPlaceActivate();

	return S_OK;
}
コード例 #20
0
STDMETHODIMP CPDPath::removeSubPaths()
{
	for (int i = m_subPaths.GetSize()-1; i >= 0; i--)
	{
		m_subPaths[i]->Unadvise(this);
		m_subPaths[i]->Release();
		m_subPaths.RemoveAt(i);
	}

	FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);

	return S_OK;
}
コード例 #21
0
void CPigShip::SetIGC(IshipIGC* pShipIGC)
{
    // Remove the AGC mapping of this object
    if (GetIGC())
        GetAGCGlobal()->RemoveAGCObject(GetIGC(), false);

    // Set the base IGC pointer of the object
    IAGCShipImplBase::Init(pShipIGC);

    // Add this as the AGC wrapper to the map
    if (pShipIGC)
        GetAGCGlobal()->AddAGCObject(pShipIGC, GetUnknown());
}
コード例 #22
0
bool CEventHandler::HookEvent(IUnknown* pSource)
{
#if defined(__USE_ADDBACK_DUAL)
    const HRESULT hr = AtlAdvise(pSource, GetUnknown(), __uuidof(IAddBackEvents), &cookie_);
    if (FAILED(hr)) return false;
#elif defined(__USE_ADDBACK_DISPATCH)
    DispEventAdvise(pSource, &__uuidof(_IAddBackEvents));
#elif defined(__USE_ADDBACK_BYATTRIB_DISPATCH)
    __hook(&_IAddBackEvents::ChangedAddEnd, pSource, &CEventHandler::onChangedAddEnd);
    __hook(&_IAddBackEvents::ChangedSum, pSource, &CEventHandler::onChangedSum);
#endif

    return true;
}
コード例 #23
0
bool CPDPage::IsLeftOfSpine()
{
	for (int pageIndex = 0; pageIndex < m_ownerSpread->m_pages->m_items.GetSize(); pageIndex++)
	{
		if (IsUnknownEqualUnknown(m_ownerSpread->m_pages->m_items[pageIndex], GetUnknown()))
		{
			break;
		}
	}

	ATLASSERT(pageIndex < m_ownerSpread->m_pages->m_items.GetSize());

	return pageIndex < m_ownerSpread->m_spine;
}
コード例 #24
0
//------------------------------------------------------------------*
HRESULT CFCMessageSessionThread::DoConnect()
{
    HRESULT hr;

    if (m_pMessage != NULL)
        return S_OK;

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

    hr = ConnectToOnlineServer(&m_pMessage);
    if (FAILED(hr))
        return hr;

    if (m_pMessage == NULL)
        return E_FAIL;

    hr = m_pMessage->QueryInterface(IID_IConnection,(void**)&m_pCheckConnection); 
    if (FAILED(hr))
        return hr;

    hr = Login();
    if (FAILED(hr)) {
        DoDisconnect();
        return hr;
    }

    hr = AtlAdvise(m_pMessage, GetUnknown(), IID__ICERemoteMessageEvent, &m_dwMsgNotifyCookie);
    if (FAILED(hr)) {
        DoDisconnect();
        return hr;
    }
    hr = m_pMessage->Connect(m_lKey);
    if (FAILED(hr)) {
        TRACE(_T("MsgSession::Connected callback: error while trying to connect to message source; 0x%08X\n"), hr);
        TrcPrint(TRC_ERROR, _T("MsgSession::Connected callback: error while trying to connect to message source; 0x%08X\n"), hr);
        DoDisconnect();
        return hr;
    }

    return hr;
}
コード例 #25
0
//////////////////////////////////////////////////////////////////////////////
// C[!output Safe_root]::SetCore
// Set WMP core interface
//////////////////////////////////////////////////////////////////////////////
STDMETHODIMP C[!output Safe_root]::SetCore(IWMPCore * pCore)
{
    HRESULT hr = S_OK;

    // release any existing WMP core interfaces
    ReleaseCore();

    // If we get passed a NULL core, this  means
    // that the plugin is being shutdown.

    if (pCore == NULL)
    {
        return S_OK;
    }

    m_spCore = pCore;

    [!if LISTENTOEVENTS]
    // connect up the event interface
    CComPtr<IConnectionPointContainer>  spConnectionContainer;

    hr = m_spCore->QueryInterface( &spConnectionContainer );

    if (SUCCEEDED(hr))
    {
        hr = spConnectionContainer->FindConnectionPoint( __uuidof(IWMPEvents), &m_spConnectionPoint );
    }

    if (SUCCEEDED(hr))
    {
        hr = m_spConnectionPoint->Advise( GetUnknown(), &m_dwAdviseCookie );

        if ((FAILED(hr)) || (0 == m_dwAdviseCookie))
        {
            m_spConnectionPoint = NULL;
        }
    }

    [!endif]
    return hr;
}
コード例 #26
0
STDMETHODIMP CPDPage::getPageRect(RectD *pVal)
{
	double x = 0;

	for (int i = 0; i < m_ownerSpread->m_pages->m_items.GetSize(); i++)
	{
		if (IsUnknownEqualUnknown(m_ownerSpread->m_pages->m_items[i], GetUnknown()))
		{
			break;
		}

		x += m_pDocument->m_pageWidth;
	}

	pVal->X = x;
	pVal->Y = 0;
	pVal->Width = m_pDocument->m_pageWidth;
	pVal->Height = m_pDocument->m_pageHeight;

	return S_OK;
}
コード例 #27
0
STDMETHODIMP CPDPath::transformPoints(IPDMatrix *matrix)
{
	if (matrix == NULL) return E_INVALIDARG;

	if (m_subPaths.GetSize() > 0)
	{
		for (int nsubpath = 0; nsubpath < m_subPaths.GetSize(); nsubpath++)
		{
			CPDSubPath* pSubPath = m_subPaths[nsubpath];
			int npoints = pSubPath->m_points.GetSize();

			for (int i = 0; i < npoints; i++)
			{
				matrix->transformBezierPoint(&pSubPath->m_points[i], &pSubPath->m_points[i]);
			}
		}

		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
	}

	return S_OK;
}
コード例 #28
0
ファイル: TangramNode.cpp プロジェクト: tangramfx/TANGRAM
STDMETHODIMP CTangramNodeCollection::get__NewEnum(IUnknown** ppVal)
{
	*ppVal = NULL;

	struct _CopyVariantFromIUnkown
	{
		static HRESULT copy(VARIANT* p1, CTangramNode* const* p2)
		{
			CTangramNode* pNode = *p2;
			p1->vt = VT_UNKNOWN;
			return pNode->QueryInterface(IID_IUnknown, (void**)&(p1->punkVal));
		}

		static void init(VARIANT* p)	{ VariantInit(p); }
		static void destroy(VARIANT* p)	{ VariantClear(p); }
	};

	typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _CopyVariantFromIUnkown, CTangramNodeVector>
		CComEnumVariantOnVector;

	CComObject<CComEnumVariantOnVector> *pe = 0;
	HRESULT hr = CComObject<CComEnumVariantOnVector>::CreateInstance(&pe);

	if (SUCCEEDED(hr))
	{
		hr = pe->AddRef();
		hr = pe->Init(GetUnknown(), *m_pNodes);

		if (SUCCEEDED(hr))
			hr = pe->QueryInterface(ppVal);

		hr = pe->Release();
	}

	return hr;
}
コード例 #29
0
ファイル: XMLDOMNodeList.cpp プロジェクト: js422/PERL
STDMETHODIMP CXMLDOMNodeList::get__newEnum(IUnknown  **pVal)
{
	ATLTRACE(_T("CXMLDOMNodeList::get__newEnum\n"));

	if (NULL == pVal)
		return E_POINTER;

	*pVal = NULL;

	CComObject<CComEnumUnknownOnNodeContainer> *pe = NULL;
	HRESULT hr = CComObject<CComEnumUnknownOnNodeContainer>::CreateInstance(&pe);
	if (S_OK != hr)
		return hr;

	pe->AddRef();

	hr = pe->Init(GetUnknown(),*this);
	if (S_OK == hr)
		hr = pe->QueryInterface(pVal);

	pe->Release();

	return hr;
}
コード例 #30
0
CPDPage* CPDPage::GetBasePage()
{
	ATLASSERT(m_baseMaster);

	for (int pageIndex = 0; pageIndex < m_ownerSpread->m_pages->m_items.GetSize(); pageIndex++)
	{
		if (IsUnknownEqualUnknown(m_ownerSpread->m_pages->m_items[pageIndex], GetUnknown()))
		{
			break;
		}
	}

	ATLASSERT(pageIndex < m_ownerSpread->m_pages->m_items.GetSize());

//	m_ownerSpread->m_spine;
//	m_baseMaster->m_pages->m_items.GetSize();

	int basepageIndex = m_baseMaster->m_pages->m_items.GetSize()-1 - (m_ownerSpread->m_spine - pageIndex);

	ATLASSERT(basepageIndex >= 0);
	ATLASSERT(basepageIndex < m_baseMaster->m_pages->m_items.GetSize());

	return static_cast<CPDPage*>((IPDPage*)(m_baseMaster->m_pages->m_items[basepageIndex]));
}