S
stone08
Unregistered / Unconfirmed
GUEST, unregistred user!
各位,我用程序将剪贴板数据保存到流,当剪贴板中包含CF_ENHMETAFILE类型的时候,就无法读取,代码如下:varhMem : THandle;S : TStream;pMem : Pointer;fmt:Word;begin S:=TStream.Create; Assert(Assigned(S)); fmt:=CF_ENHMETAFILE; hMem := Clipboard.GetAsHandle(fmt); hmem := GetClipboardData(fmt); if hMem <> 0 then begin pMem := GlobalLock(hMem); //这就是出问题的地方,pMem返回nil if pMem <> nil then begin try S.Write(pMem^, GlobalSize(hMem)); S.Position := 0; finally GlobalUnlock(hMem); end; end; end;分不够可以再加或另贴给分!