Clipboard to Text File

I'm tired, but need this answer when I arrrive at work tomorrow AM... Would anyone please be willing to help me out with this one?

I have a memo field a DBMemo component and want to copy it to the clipboard (DMBemo1.CopyToClipboard).  No problem.

Now I want to create a temporary text file called, say, C:\BIND.TXT.  The contents of BIND.TXT should be the contents of the DBMemo field.  Any easy way to create the text file and pump the contents of the clipboard in?

Thanks in advance,
Who is Participating?
rwilson032697Connect With a Mentor Commented:
Do it like this (without the clipboard)



If you really need to get it from the clipboard you have a couple of options:

1)You could paste the clipboard data into a memo/richEdit and then save, or

2)call the TClipboard.getTextBuf method and write the data to a file yourself.

GetTextBuf retrieves the control's text and copies it to a buffer.

function GetTextBuf(Buffer: PChar; BufSize: Integer): Integer;


Use GetTextBuf to retrieve text from a control and copy it into the buffer pointed to by Buffer. GetTextBuf copies up to the number of characters given by BufSize, and returns the number of characters copied.
The resulting text in Buffer is a null-terminated string.
To find out how many characters the buffer needs to hold the entire text call the GetTextLen method before calling GetTextBuf.

wkhaysAuthor Commented:
Cheers, rwilson.  Simple and to the point - I learn this stuff as I go along.  Thanks for your comment as well, Mike.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.