当前位置: 首页>>代码示例>>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;未经允许,请勿转载。