Link to home
Start Free TrialLog in
Avatar of wkhays
wkhays

asked on

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,
WKHays
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

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

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;

Description

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.



GL
Mike
Avatar of wkhays

ASKER

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

WKHays