当前位置: 首页>>代码示例>>C++>>正文


C++ LPDATAOBJECT::QueryGetData方法代码示例

本文整理汇总了C++中LPDATAOBJECT::QueryGetData方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDATAOBJECT::QueryGetData方法的具体用法?C++ LPDATAOBJECT::QueryGetData怎么用?C++ LPDATAOBJECT::QueryGetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDATAOBJECT的用法示例。


在下文中一共展示了LPDATAOBJECT::QueryGetData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoDragDrop

DROPEFFECT COleServerItem::DoDragDrop(LPCRECT lpItemRect, CPoint ptOffset,
	BOOL bIncludeLink, DWORD dwEffects, LPCRECT lpRectStartDrag)
{
	ASSERT(AfxIsValidAddress(lpItemRect, sizeof(RECT)));
	ASSERT_VALID(this);

	ASSERT_VALID(this);

	DROPEFFECT dropEffect = DROPEFFECT_NONE;
	COleDataSource *pDataSource = NULL;
	TRY
	{
		// get clipboard data for this item
		CSize sizeItem(
			lpItemRect->right - lpItemRect->left,
			lpItemRect->bottom - lpItemRect->top);
		pDataSource = OnGetClipboardData(bIncludeLink, &ptOffset, &sizeItem);

		// add DROPEFFECT_LINK if link source is available
		LPDATAOBJECT lpDataObject = (LPDATAOBJECT)
			pDataSource->GetInterface(&IID_IDataObject);
		ASSERT(lpDataObject != NULL);
		FORMATETC formatEtc;
		formatEtc.cfFormat = (CLIPFORMAT)_oleData.cfLinkSource;
		formatEtc.ptd = NULL;
		formatEtc.dwAspect = DVASPECT_CONTENT;
		formatEtc.lindex = -1;
		formatEtc.tymed = (TYMED)-1;
		if (lpDataObject->QueryGetData(&formatEtc) == S_OK)
			dwEffects |= DROPEFFECT_LINK;

		// calculate default sensitivity rectangle
		CRect rectDrag;
		if (lpRectStartDrag == NULL)
		{
			rectDrag.SetRect(lpItemRect->left, lpItemRect->top, lpItemRect->left,
				lpItemRect->top);
			lpRectStartDrag = &rectDrag;
		}

		// do drag drop operation
		dropEffect = pDataSource->DoDragDrop(dwEffects, lpRectStartDrag);
		pDataSource->InternalRelease();
	}
	CATCH_ALL(e)
	{
		if (pDataSource != NULL)
			pDataSource->InternalRelease();

		THROW_LAST();
	}
	END_CATCH_ALL

	return dropEffect;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:55,代码来源:olesvr2.cpp

示例2: AcceptType

bool FTPWindow::AcceptType(LPDATAOBJECT pDataObj) {
	FORMATETC fmtetc;

	fmtetc.ptd	    = NULL;
	fmtetc.dwAspect = DVASPECT_CONTENT;
	fmtetc.lindex   = -1;
	fmtetc.tymed	= TYMED_HGLOBAL;
	fmtetc.cfFormat = CF_HDROP;

	if (pDataObj->QueryGetData(&fmtetc) == NOERROR)
		return true;

	return false;
}
开发者ID:Praymundo,项目名称:NppFTP,代码行数:14,代码来源:FTPWindow.cpp

示例3: GetDropEffect

DWORD CEdit::GetDropEffect( LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINTL pt, CEditView *&pView, int &nBuffCol, int &nRow )
{
	DWORD dwEffect = DROPEFFECT_NONE;

	if ( !m_Buffer.IsReadOnly() )
	{
		POINT ptClient = { pt.x, pt.y };
		ScreenToClient( m_hWnd, &ptClient );
		int nView;
		if ( HitTest( ptClient.x, ptClient.y, nView ) == eEditSpace && !PtInSelection( ptClient.x, ptClient.y, FALSE ) )
		{
			FORMATETC fe = { CLIP_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
			if ( pIDataSource->QueryGetData( &fe ) == S_OK )
			{
				RECT rcChar;
				pView = m_Views[ nView ];
				pView->GetCharPosFromPoint( ptClient.x, ptClient.y, nBuffCol, nRow, &rcChar );
				nBuffCol = m_Buffer.ConvertViewColToBufferCol( nRow, nBuffCol );
				if ( !IsRectEmpty( &rcChar ) && ( ptClient.x > ( ( rcChar.left + rcChar.right ) / 2 ) ) )
				{
					// cursor is closer to the next char
					nBuffCol += m_Buffer.GetCharSize( nRow, nBuffCol );
				}
				dwEffect = ( HAS_FLAG( grfKeyState, MK_CONTROL ) ? DROPEFFECT_COPY : DROPEFFECT_MOVE );
				if ( pView->ScrollIfNearBorder( ptClient.x, ptClient.y, TRUE ) )
				{
					dwEffect |= DROPEFFECT_SCROLL;
				}
				// make sure the effect is allowed by the source object
				m_DropTarget.NormalizeDropEffect( dwEffect );
			}
		}
	}

	return dwEffect;
}
开发者ID:ForbiddenEra,项目名称:kx-audio-driver,代码行数:36,代码来源:DRAGDROP.CPP

示例4: Drop

STDMETHODIMP QOleDropTarget::Drop( LPDATAOBJECT pIDataSource,
                                   DWORD grfKeyState,
                                   POINTL pt,
                                   LPDWORD pdwEffect )
{
#ifdef DEBUG_QDND_TGT
    qDebug( "QOleDropTarget::Drop( %p, %d, %d/%d, %d )",
            pIDataSource, grfKeyState, pt.x, pt.y, *pdwEffect );
    qDebug( "widget: %p, winID: %08x", widget, widget ? widget->winId() : 0 );
#endif

    if ( !qt_tryModalHelper( widget ) ) {
        *pdwEffect = DROPEFFECT_NONE;
        return NOERROR;
    }

    lastPoint = widget->mapFromGlobal( QPoint( pt.x, pt.y ) );
    // grfKeyState does not all ways contain button state in the drop so if
    // it doesn't then use the last known button state;
    if ( ( grfKeyState & KEY_STATE_BUTTON_MASK ) == 0 )
        grfKeyState |= lastKeyState & KEY_STATE_BUTTON_MASK;
    lastKeyState = grfKeyState;

    FORMATETC s_fmtMemory = { 0,
                              NULL,
                              DVASPECT_CONTENT,
                              -1,
                              TYMED_HGLOBAL };

    /* Can we convert the data? */
    bool found = false;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c && !found; c = all.next() ) {
        for ( int i = 0; i < c->countCf(); i++ ) {
            int cf = c->cf( i );
            s_fmtMemory.cfFormat = cf;
            if ( pIDataSource->QueryGetData( &s_fmtMemory ) == S_OK ) {
                found = true;
                break;
            }

        }
    }
    if ( !found ) {
        return S_OK;
    }
    /* Just to be sure */
    pIDataObject = pIDataSource;

    pIDataObject->AddRef();
    QDropEvent de( lastPoint );
    de.setAction( translateKeyStateToQDropAction( grfKeyState, *pdwEffect ) );
    if ( global_src )
        global_src->setTarget( widget );
    QApplication::sendEvent( widget, &de );

    pIDataObject->Release();
    pIDataObject = NULL;

    return S_OK;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:61,代码来源:qdnd_win.cpp

示例5: UtQueryPictFormat

FARINTERNAL_(BOOL) UtQueryPictFormat(LPDATAOBJECT lpSrcDataObj,
		LPFORMATETC lpforetc)
{
	FORMATETC foretctemp; // local copy of current values of format desc
	VDATEHEAP();

	LEDebugOut((DEB_ITRACE, "%p _IN UtQueryPictFormat ( %p , %p )\n",
		NULL, lpSrcDataObj, lpforetc));

	// copy format descriptor
	foretctemp = *lpforetc;

	// set values and query for our preferred formats in order of
	// preference

	
	foretctemp.cfFormat = CF_METAFILEPICT;
	foretctemp.tymed = TYMED_MFPICT;        
	if (lpSrcDataObj->QueryGetData(&foretctemp) == NOERROR)
	{
		goto QuerySuccess;
	}

	foretctemp.cfFormat = CF_ENHMETAFILE;
	foretctemp.tymed = TYMED_ENHMF;
	if( lpSrcDataObj->QueryGetData(&foretctemp) == NOERROR )
	{
		goto QuerySuccess;
	}
	foretctemp.cfFormat = CF_DIB;
	foretctemp.tymed = TYMED_HGLOBAL;       
	if (lpSrcDataObj->QueryGetData(&foretctemp) == NOERROR)
	{
		goto QuerySuccess;
	}
	
	foretctemp.cfFormat = CF_BITMAP;
	foretctemp.tymed = TYMED_GDI;   
	if (lpSrcDataObj->QueryGetData(&foretctemp) == NOERROR)
	{
		goto QuerySuccess;
	}

	LEDebugOut((DEB_ITRACE, "%p OUT UtQueryPictFormat ( %lu )\n",
		NULL, FALSE));

	return FALSE;

QuerySuccess:
	// data object supports this format; change passed in
	// format to match

	lpforetc->cfFormat = foretctemp.cfFormat;
	lpforetc->tymed = foretctemp.tymed;

	// return success

	LEDebugOut((DEB_ITRACE, "%p OUT UtQueryPictFormat ( %lu )\n",
		NULL, TRUE));

	return(TRUE);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:62,代码来源:ole2util.cpp


注:本文中的LPDATAOBJECT::QueryGetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。