可使用,看原代码吧,使用他还可以省略很多步骤。
procedure TClipboard.SetAsHandle(Format: Word;
Value: THandle);
begin
Open;
try
Adding;
SetClipboardData(Format, Value);
finally
Close;
end;
end;
function TClipboard.GetAsHandle(Format: Word): THandle;
begin
Open;
try
Result := GetClipboardData(Format);
finally
Close;
end;
end;
还有Win32Help. //CoreAPI好象是错的,不用释放内存。
Once SetClipboardData is called, <font color=red>the system owns the object
identified by the hMem parameter</font>. The application can read the data,
but <font color=red>must not free the handle or leave it locked</font>. If the hMem
parameter identifies a memory object, the object must have been
allocated using the GlobalAlloc function with the GMEM_MOVEABLE and
GMEM_DDESHARE flags.