Solved

Copy selected text to clipboard

Posted on 2000-04-08
6
174 Views
Last Modified: 2010-04-04
This sounds simple I know but is there a simple way to copy the selected text of a memo to the clipboard directly?

I know about memo1.copytoclipboard but it only copies all the controls text.. or am I missing something?
0
Comment
Question by:isis071598
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:edey
ID: 2697017
you can send the memo a:

WM_COPY

wParam = 0; // not used; must be zero
lParam = 0; // not used; must be zero
 

An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.



GL
mike
0
 
LVL 1

Author Comment

by:isis071598
ID: 2697030
Any chance of a bit of source?

Regards,
Isis
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2697039
var Clip:TClipBoard;
    SelText:string;
begin
    Clip:=TClipBoard.Create;
    Memo1.Selstart:=0;
    Memo1.sellength:=25;
    Seltext:=Copy(Memo1.Lines.GetText,Memo1.SelStart,Memo1.SelLength);
    Clip.SetTextBuf(pchar(SelText));
end;



/// obviously, you can disregard the part where I set SelStart and SelLength if you are selcting the text manually.


Good luck!!
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 1

Author Comment

by:isis071598
ID: 2697045
DrDelphi - Looks good - the points are yours. Answer it.

0
 
LVL 6

Accepted Solution

by:
DrDelphi earned 50 total points
ID: 2697187
Thanks.
0
 
LVL 1

Author Comment

by:isis071598
ID: 2697340
Thanks a bunch!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question