OL_WinCBPaste() Place text into the MS Windows clipboard. ──────────────────────────────────────────────────────────────────────────────
Syntax
OL_WinCBPaste( <cText> ) --> lPasted
Arguments
<cText> is the text to place into the Windows clipboard.
Returns
A logical value, .T. if the text was pasted, .F. if not.
Description
OL_WinCBPaste() can be used to place text into the Windows clipboard when your application is running in a DOS window.
If the text is pasted into the clipboard the function will return true (.T.), if not, it will return false (.F.). For the function to fail to paste one of the following has to happen:
a) The application is not running under MS Windows. b) The DOS paste service is not available. c) The clipboard could not be opened.
The information used to write this function was taken from ``Hands On - Low Level'' in Personal Computer World - December 1992, Page 451. This article states that there is a problem using the described method with Windows 3.1. I have tested this function with Windows 3.1, WFWG versions 3.1 and 3.11 and Windows 95 and it appears to work fine.
NOTE: Because this function needs to do some extra stuff when your application is running in protected mode I've had to make use of the CPMI library. You must link this in if you intend to use this function, even if you are linking for real mode operation.
Examples
// Function to take a customer's address details and paste them // Into the Windows clipboard.
#define CR_LF chr(13) + chr(10)
Function AddresToClip()
If OL_WinCBPaste( alltrim( Customer->Address1 ) + CR_LF + ; alltrim( Customer->Address2 ) + CR_LF + ; alltrim( Customer->Address3 ) + CR_LF + ; alltrim( Customer->Address4 ) + CR_LF + ; alltrim( Customer->Address5 ) + CR_LF ) // Tell the user that it worked. Else // Tell the user that it didn't work. EndIf