Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C5 trying to read clipboard as HTML
Message
De
01/02/2010 20:49:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
C5 trying to read clipboard as HTML
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01447039
Message ID:
01447039
Vues:
118
One of my users is getting a consistent C5 error when trying to read the clipboard as HTML (having been pasted there from Excel)

The code I am using looks like this:
Procedure ReadClipboardasHTML

	Local lcString, lcCF, lnH, lnLen, lxPtr

	Declare Long GlobalLock In Win32API Long Hmem
	Declare Long GlobalUnlock In Win32API Long Hmem
	Declare Long GlobalSize In Win32API Long Hmem
	Declare String lstrcpy In Win32API String @ lpDest, Long lpSrc
	Declare Long OpenClipboard In Win32API Long
	Declare Long CloseClipboard In Win32API
	Declare Long RegisterClipboardFormat In Win32API String
	Declare Long GetClipboardData In Win32API Long uFormat

	lcString = ""
	*  lcCF = RegisterClipboardFormat ("Rich Text Format")
	lcCF = RegisterClipboardFormat ("HTML Format")
	If (OpenClipboard (0) != 0)
		lnH = GetClipboardData (lcCF)
		If lnH > 0
			lnLen = GlobalSize (lnH)
			lcString = Replicate (Chr (0), lnLen)
			lxPtr = GlobalLock (lnH)
			lstrcpy (@lcString, lxPtr)
			lcString = Left (lcString, lnLen-1)
			GlobalUnlock (lnH)
		Endif
		CloseClipboard ()
	Endif

	Return Substr (lcString, At ("<", lcString))

Endproc
Any ideas or suggestions?

Thanks in advance,
Jim Nelson
Newbury Park, CA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform