Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Move RTF-Text to Clipboard
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00486560
Message ID:
00486752
Vues:
10
>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
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform