Delphi中获取剪贴板文字内容的代码
分类:Delphi
阅读 (27,412)
Add comments
8月 232012
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
uses Clipbrd; procedure TForm1.Button1Click(Sender: TObject); var CbBuf: PChar; BufSize: Integer; H: THandle; begin if Clipboard.HasFormat(CF_TEXT) then begin H := ClipBoard.GetAsHandle(CF_TEXT); BufSize := GlobalSize(H); GetMem(CbBuf, BufSize); BufSize := Clipboard.GetTextBuf(cbBuf, BufSize); Edit1.Text := cbBuf; end; end; |