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


C++ CClient::RequestCopiedFiles方法代码示例

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


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

示例1: OnRenderGlobalData

//##ModelId=474D305803BB
BOOL COleClipSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal)
{
	static bool bInHere = false;

	if(bInHere)
	{
		return FALSE;
	}
	bInHere = true;

	HGLOBAL hData = NULL;

	CClipFormat *pFind = m_DelayRenderedFormats.FindFormat(lpFormatEtc->cfFormat);

	if(pFind)
	{
		if(pFind->m_hgData)
		{
			hData = NewGlobalH(pFind->m_hgData, GlobalSize(pFind->m_hgData));
		}
	}
	else
	{
		CClip clip;

		clip.LoadFormats(m_ClipIDs[0]);

		CClipFormat *pDittoDelayCF_HDROP = clip.m_Formats.FindFormat(theApp.m_RemoteCF_HDROP);
		CClipFormat *pCF_HDROP = clip.m_Formats.FindFormat(CF_HDROP);

		if(pDittoDelayCF_HDROP && pCF_HDROP)
		{
			CDittoCF_HDROP *pData = (CDittoCF_HDROP*)GlobalLock(pDittoDelayCF_HDROP->m_hgData);
			if(pData)
			{
				CString csComputerName;
				CString csIP;

				CTextConvert::ConvertFromUTF8(pData->m_cIP, csIP);
				CTextConvert::ConvertFromUTF8(pData->m_cComputerName, csComputerName);
				
				GlobalUnlock(pDittoDelayCF_HDROP->m_hgData);

				CClient cl;
				hData = cl.RequestCopiedFiles(*pCF_HDROP, csIP, csComputerName);
			}
		}
		else
		{
			hData = m_ClipIDs.Render(lpFormatEtc->cfFormat);
		}

		//Add to a cache of already rendered data
		//Windows seems to call this function multiple times
		//so only the first time do we need to go get the data
		HGLOBAL hCopy = NULL;
		if(hData)
		{
			hCopy = NewGlobalH(hData, GlobalSize(hData));
		}

		CClipFormat format(lpFormatEtc->cfFormat, hCopy);
		format.bDeleteData = false; //owned by m_DelayRenderedFormats
		m_DelayRenderedFormats.Add(format);
	}

	BOOL bRet = FALSE;
	if(hData)
	{
		// if phGlobal is null, we can just give the allocated mem
		// else, our data must fit within the GlobalSize(*phGlobal)
		if(*phGlobal == 0)
			*phGlobal = hData;
		else
		{
			UINT len = min(::GlobalSize(*phGlobal), ::GlobalSize(hData));
			if(len)
				CopyToGlobalHH(*phGlobal, hData, len);
			::GlobalFree(hData);
		}
		bRet = TRUE;
	}

	bInHere = false;

	return bRet;
}
开发者ID:arefinsaaad,项目名称:kupl09,代码行数:88,代码来源:OleClipSource.cpp


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