Link to home
Start Free TrialLog in
Avatar of nod31
nod31

asked on

clipbrd

i have a memo and would like to know how can i :-

 read contents of clipboard into it using a button
 write contents of memo to the clipboard
 clear the clipboard
ASKER CERTIFIED SOLUTION
Avatar of edey
edey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mohammed Nasman
Hello

To copy text from memo to clipboard
  Memo1.CopyToClipboard;

to copy text from Clipboard to memo
  Memo1.PasteFromClipboard;

Avatar of edey
edey

Oh, I hadn't thought of that, though it would work just fine.  You'll only have to chek & ensure that there's text in the clipboard, something like this should work:

if clipBoard.hasFormat(CF_TEXT) then
 memo1.pasteFromClipBoard;

GL
Mike
I forgot the third thing, if you want to clear the clipboard

uses  clipbrd ;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ClipBoard.Clear;
end;