|
procedure TForm1.Button1Click(Sender: TObject);
var
s:String;
hClip:HWND;
pText Char; //pch
ocResult ongbool;
begin
S:='This is a Clipboard example.';
ocResult:=OpenClipboard(self.Handle);
EmptyClipboard();
hClip:=GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,Length(S)+4);
PText:=PChar(GlobalLock(hClip));
SendMessage(hClip,WM_COPY,255,Integer(PChar('1234g')));
memcpy(pText,PChar(s),Length(S)+4); //StrCopy(pText,PChar(S));
//edt_send.Text:=pText;
GlobalUnlock(hClip);
SetClipboardData(CF_TEXT,hClip);
//GlobalFree(hClip);
CloseClipboard;
end; |
|