Link to home
Start Free TrialLog in
Avatar of TechStone
TechStone

asked on

Put a String on the Clipboard

In my program I have a string that I want to put on the clipboard, so I can paste it in another application (for example a word processor).  How do I do that?
ASKER CERTIFIED SOLUTION
Avatar of JimBob091197
JimBob091197

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 JimBob091197
JimBob091197

P.S.  Add ClipBrd to your uses clause in order to use TClipBoard.
Avatar of TechStone

ASKER

Thank you, that works perfectly!

procedure CopyButtonClick(Sender: TObject);
begin
   If ActiveControl is TMemo then TMemo(ActiveControl).CopyToClipboard;
   If ActiveControl is TDBMemo then TDBMemo(ActiveControl).CopyToClipboard;
   If ActiveControl is TEdit then TEdit(ActiveControl).CopyToClipboard;
   If ActiveControl is TDBedit then TDBedit(ActiveControl).CopyToClipboard;
end;

procedure PasteButtonClick(Sender: TObject);
begin
   If ActiveControl is TMemo then TMemo(ActiveControl).PasteFromClipboard;
   If ActiveControl is TDBMemo then TDBMemo(ActiveControl).PasteFromClipboard;
   If ActiveControl is TEdit then TEdit(ActiveControl).PasteFromClipboard;
   If ActiveControl is TDBedit then TDBedit(ActiveControl).PasteFromClipboard;
end;