>Hello all,
>
>I'm will move the Text from a RTF-Control to the Clipboard. Now in the
>Microsoft-MSDN-Hompage i'm found an messageentry No 258513, writen for
>VB.
>
>The my example work with VFP:
>
>******************************************************************
>* Move RTF-Text in Clipboard
>******************************************************************
>Declare integer OpenClipboard in user32 integer lnHwnd
>declare integer RegisterClipboardFormat in USER32 AS RegisterClipboardFormat STRING lcString
>declare integer EmptyClipboard in USER32
>declare integer CloseClipboard in USER32
>declare integer SetClipboardData in user32 integer lcFormat, integer hMem
>declare integer GlobalAlloc in kernel32.dll integer wFlags, integer dwBytes
>declare integer GlobalLock in kernel32.dll integer hMem
>declare integer GlobalUnlock in kernel32.dll integer hmem
>declare integer GlobalFree in kernel32.dll integer hmem
>DECLARE INTEGER memmove IN MSVCRT as CopyMemory;
> INTEGER lpvDest, ;
> STRING @ lpvSource, ;
> INTEGER dwLength && Copy from a VFP memvar to an address
>
>local lcRTF, lnByte, lnSuccess, lnRTF, lnGlobal, lnString
>
>lcRTF = this.lcRTFText && Text writen with the RTF-Control
>lnByte = len(this.lcRtfText)
>
>
>lnSuccess = OpenClipboard(0)
>lnRTF = RegisterClipboardFormat("Rich Text Format")
>lnSuccess = EmptyClipboard()
>lnGlobal = GlobalAlloc(0,lnByte)
>lnString = GlobalLock(lnGlobal)
>CopyMemory(lnString, @lcRTF , lnByte )
>GlobalUnlock(lnGlobal)
>SetClipboardData(lnRTF,lnGlobal)
>CloseClipboard()
>globalFree(lnGlobal)
>
>******************************************************************
>
>The problem is:
>
>In the originalmessage from Microsoft the API-Functon "GlobalAlloc"
>is called:
>
>Private Const GMEM_DDESHARE = &H2000
>Private Const GMEM_MOVEABLE = &H2
>
>Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, _
> ByVal dwBytes As Long) As Long
>
>hGlobal = GlobalAlloc(GMEM_MOVEABLE Or GMEM_DDESHARE, Len(sRTF))
>
>
>What is the VFP-Code for the Memory-Pointer's (&H2000 or &H2) ?????
0x2000 and 0x2 respectively:
#DEFINE GMEM_DDESHARE 0x2000
#DEFINE GMEM_MOVEABLE 0x2