Solved

Copy selected text to clipboard

Posted on 2000-04-08
6
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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