Exemplo n.º 1
0
STDMETHODIMP CActiveXCtrl::OnInPlaceActivateEx(BOOL* pfNoRedraw, DWORD dwFlags)        
{
    TRACE(_T("AX: CActiveXCtrl::OnInPlaceActivateEx"));
    ASSERT(m_pInPlaceObject==NULL);
    if( m_pOwner == NULL ) return E_UNEXPECTED;
    if( m_pOwner->m_pUnk == NULL ) return E_UNEXPECTED;
    ::OleLockRunning(m_pOwner->m_pUnk, TRUE, FALSE);
    HWND hWndFrame = m_pOwner->GetManager()->GetPaintWindow();
    HRESULT Hr = E_FAIL;
    if( (dwFlags & ACTIVATE_WINDOWLESS) != 0 ) {
        m_bWindowless = true;
        Hr = m_pOwner->m_pUnk->QueryInterface(IID_IOleInPlaceObjectWindowless, (LPVOID*) &m_pInPlaceObject);
        m_pOwner->m_hwndHost = hWndFrame;
        m_pOwner->GetManager()->AddMessageFilter(m_pOwner);
    }
    if( FAILED(Hr) ) {
        m_bWindowless = false;
        Hr = CreateActiveXWnd();
        if( FAILED(Hr) ) return Hr;
        Hr = m_pOwner->m_pUnk->QueryInterface(IID_IOleInPlaceObject, (LPVOID*) &m_pInPlaceObject);
    }
    if( m_pInPlaceObject != NULL ) {
        CRect rcItem = m_pOwner->m_rcItem;
        if( !m_bWindowless ) rcItem.ResetOffset();
        m_pInPlaceObject->SetObjectRects(&rcItem, &rcItem);
    }
    m_bInPlaceActive = SUCCEEDED(Hr);
    return Hr;
}
Exemplo n.º 2
0
STDMETHODIMP AxContainer::OnInPlaceActivateEx(BOOL* pfNoRedraw, DWORD dwFlags)        
{
	if ( m_pAxWidge == NULL ) 
		return E_UNEXPECTED;
	if ( m_pOleObject == NULL ) 
		return E_UNEXPECTED;
	::OleLockRunning(m_pOleObject, TRUE, FALSE);
	HWND hWndFrame = m_pAxWidge->GetParentWnd();
	HRESULT hr = E_FAIL;
	if ( (dwFlags & ACTIVATE_WINDOWLESS) != 0 ) 
	{
		m_bWindowless = true;
		hr = m_pOleObject->QueryInterface(IID_IOleInPlaceObjectWindowless, (LPVOID*) &m_pInPlaceObject);
		m_hwndHost = hWndFrame;
	}
	if ( FAILED(hr) ) 
	{
		m_bWindowless = false;
		hr = CreateActiveXWnd();
		if ( FAILED(hr) ) 
			return hr;
		hr = m_pOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID*) &m_pInPlaceObject);
	}
	if ( m_pInPlaceObject != NULL ) 
	{
		RECT rcItem = m_pAxWidge->GetControlRect();
		if ( !m_bWindowless ) 
			::OffsetRect(&rcItem, -rcItem.left, -rcItem.top);
		m_pInPlaceObject->SetObjectRects(&rcItem, &rcItem);
	}
	m_bInPlaceActive = SUCCEEDED(hr);
	return hr;
}
Exemplo n.º 3
0
STDMETHODIMP CActiveXCtrl::GetWindow(HWND* phwnd)
{
    TRACE(_T("AX: CActiveXCtrl::GetWindow"));
    if( m_pOwner == NULL ) return E_UNEXPECTED;
    if( m_pOwner->m_hwndHost == NULL ) CreateActiveXWnd();
    if( m_pOwner->m_hwndHost == NULL ) return E_FAIL;
    *phwnd = m_pOwner->m_hwndHost;
    return S_OK;
}
Exemplo n.º 4
0
STDMETHODIMP AxContainer::GetWindow(HWND* phwnd)
{
	if ( m_pAxWidge == NULL ) 
		return E_UNEXPECTED;
	if ( m_hwndHost == NULL ) 
		CreateActiveXWnd();
	if ( m_hwndHost == NULL ) 
		return E_FAIL;
	*phwnd = m_hwndHost;
	return S_OK;
}