Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Move RTF-Text to Clipboard
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Move RTF-Text to Clipboard
Divers
Thread ID:
00486560
Message ID:
00486560
Vues:
52
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform