當前位置: 首頁>>代碼示例>>C++>>正文


C++ LPDATAOBJECT::SetData方法代碼示例

本文整理匯總了C++中LPDATAOBJECT::SetData方法的典型用法代碼示例。如果您正苦於以下問題:C++ LPDATAOBJECT::SetData方法的具體用法?C++ LPDATAOBJECT::SetData怎麽用?C++ LPDATAOBJECT::SetData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LPDATAOBJECT的用法示例。


在下文中一共展示了LPDATAOBJECT::SetData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: writeToDataObject

int writeToDataObject(LPDATAOBJECT lpDataObject, UINT fid, std::istream& is, HWND hwnd, int bufsize)
{
	HANDLE hDib = 0;
	// The client placed the bitmap HANDLE in the stream
	// Note: the SController adds a trailing null char to the data (hence the +1)
	if ((bufsize) && (bufsize == sizeof (HANDLE) + 1)) 
    {
		HANDLE hBitmapTemp;		
		is.read ((char *)&hBitmapTemp, sizeof (HANDLE));		
		hDib = hBitmapTemp;
		//hDib = (HBITMAP)::OleDuplicateData (hBitmapTemp, Format::F_IGLAYER, 0);
    }
	
	if (hDib == 0)
	{
		return 0;
	}
	
	FORMATETC format;
	STGMEDIUM medium;
	ZeroMemory (&format, sizeof (format));
	ZeroMemory (&medium, sizeof (medium));
	
	format.cfFormat = static_cast<CLIPFORMAT> (fid);
	format.dwAspect = DVASPECT_CONTENT;
	format.ptd = 0;
	format.lindex = -1;
	medium.tymed = format.tymed = TYMED_HGLOBAL;
	medium.hGlobal = hDib;
	medium.pUnkForRelease = 0;
	
	lpDataObject->SetData (&format, &medium, TRUE);
	return 1;
}
開發者ID:Bitlsoft,項目名稱:Imagenius_SDK,代碼行數:34,代碼來源:FIGLayer.cpp

示例2: _AfxLoadObjectFromStreamedPropset

BOOL AFXAPI _AfxLoadObjectFromStreamedPropset(LPUNKNOWN lpUnknown, LPSTREAM lpStream)
{
	ASSERT_POINTER(lpUnknown, IUnknown);
	ASSERT_POINTER(lpStream, IStream);

	BOOL bSuccess = FALSE;
	LPDATAOBJECT pDataObj = NULL;

	if (SUCCEEDED(lpUnknown->QueryInterface(IID_IDataObject,
			(LPVOID*)&pDataObj)))
	{
		ASSERT_POINTER(pDataObj, IDataObject);

		// Set the persistent propset format on the object.

		FORMATETC formatEtc;
		STGMEDIUM stgMedium;
		formatEtc.cfFormat = _AfxGetClipboardFormatPersistPropset();
		formatEtc.ptd = NULL;
		formatEtc.dwAspect = DVASPECT_CONTENT;
		formatEtc.lindex = -1;
		formatEtc.tymed = TYMED_ISTREAM;

		stgMedium.tymed = TYMED_ISTREAM;
		stgMedium.pstm = lpStream;
		stgMedium.pUnkForRelease = NULL;

		bSuccess = SUCCEEDED(pDataObj->SetData(&formatEtc, &stgMedium, FALSE));

		pDataObj->Release();
	}

	return bSuccess;
}
開發者ID:anyue100,項目名稱:winscp,代碼行數:34,代碼來源:ctlpset.cpp


注:本文中的LPDATAOBJECT::SetData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。