globalsize怎么用

来源:百度知道 编辑:UC知道 时间:2024/06/20 00:05:40
举个例子吧

if(AfxGetMainWnd()->OpenClipboard()) int nLength=GlobalSize(hData);//得到剪贴板数据大小
strFrom.GetBufferSetLength(nLength);
memcpy(strFrom.GetBuffer(nLength),GlobalLock
{
HGLOBAL hData = GetClipboardData(m_dwNewClipboardFormat);//m_dwNewClipboardFormat为自己注册的一种剪贴板数据格式
if(hData != NULL)
{
(hData),nLength);
GlobalUnlock(hData);
}
CloseClipboard();
}

========================
GlobalSize

The GlobalSize function retrieves the current size of the specified global memory object, in bytes.

Note The global functions are slower than other memory management functions and do not provide as many features. Therefore, new applications should use the heap functions. However, the global functions are still used with DDE and the clipboard functions.

SIZE_T GlobalSize(
HGLOBAL hMem
);

Parameters
hMem
[in]