Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clipboard
Message
 
À
14/01/2002 15:01:05
David Foulkes
Probusiness Systems, Inc.
Cedar Park, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00604527
Message ID:
00605968
Vues:
13
Hi,
Although I wrote that it's not very easy, I found an acceptable solution since that time. This code places BMP, JPG and GIF images into clipboard in bitmap format and based on fact that LOADPICTURE() returns an StdPicture object:
#define CF_BITMAP	2
#define CF_PALETTE	9

Declare Long OpenClipboard In user32 Long hWnd
Declare Long CloseClipboard In user32
Declare Long EmptyClipboard In user32
Declare Long SetClipboardData In user32 Long uFormat, Long hMem
Declare Long CopyImage In user32 Long, Long, Long, Long, Long

lcFileName = GetPict()
If !Empty(lcFileName)
	oPict = LoadPicture(lcFileName)
	If oPict.Type = 1	&& Bitmap (BMP, JPG, GIF files)
		h = CopyImage(oPict.Handle, 0, 0, 0, 0)
		ClearClipboard()
		SetClipData(h, CF_BITMAP)
		If oPict.HPal != 0
			SetClipData(oPict.HPal, CF_PALETTE)
		EndIf
	EndIf
EndIf

Procedure ClearClipboard
	If OpenClipboard(0) != 0
		EmptyClipboard()
		CloseClipboard()
	EndIf
EndProc

Procedure SetClipData(thMem, tnFormat)
	If OpenClipboard(0) != 0
		SetClipboardData(tnFormat, thMem)
		CloseClipboard()
	EndIf
EndFunc
>We'd like to be able to place an image in the clipboard. The image could be a JPG, BMP, or TIF. Foxtools.fll has some commands associated with getting the clipboard but I couldn't figure out, if possible, how to load the clipboard up with an image.
>Any ideas?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform