Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Move RTF-Text to Clipboard
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00486560
Message ID:
00486566
Views:
17
>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) ?????
>
>Hendrick

That's VB representation of a hexadecimal number. For VFP, you can use 0x2000 and 0x2 (or just plain 8192 and 2).
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform