procedure CopyStringToClipboard(s: string);
var
hg: THandle;
P: PChar;
begin
hg:=GlobalAlloc(GMEM_DDESHARE or GMEM_MOVEABLE, Length(S)+1);
P:=GlobalLock(hg);
StrPCopy(P, s);
GlobalUnlock(hg);
OpenClipboard(Application.Handle);
SetClipboardData(CF_TEXT, hg);
CloseClipboard;
GlobalFree(hg);
end;
|