Copy PRG contents to Clipboard

In VFP 9.0 PRG contents will be copied to clipboard in RTF format as well, if there's no 'X' in the _Vfp.EditorOptions.

The code uses Editor functions from Foxtools.fll. See George Tasker's Extended Foxtools Help Download #9333 on UT for more info.

This is sample code. Add error handling and adjust to your requirements as necessary.

#DEFINE FO_READONLY	0
 
LOCAL ARRAY laEnv [25]
LOCAL lnHandle, lnResult
SET LIBRARY TO FoxTools ADDITIVE
&& Open the VFP Editor
lnHandle = _EdOpenFil(lcFile, FO_READONLY)
lnResult = _EdGetEnv( lnHandle, @laEnv )
&& [ 2 ]  File Size
&& Select ALL
_EdSelect(lnHandle, 0, laEnv[2])
 
llOK = .T.
&& Copy to clipboard
IF NOT _EdCopy(lnHandle)
	MESSAGEBOX("Couldn't Copy ")
	llOK = .F.
ENDIF	
&& Close Editor window
= _Wclose(lnHandle)