Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Drag and Drop
Message
 
To
17/03/1999 18:02:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00198952
Message ID:
00198963
Views:
38
Erik,

Yes you can process datatype 15 or CF_FILES. Here's some code from a OLEDragOver event;
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState

IF nState == 0 && Drag Enter
   IF oDataObject.GetFormat( 15 ) && Files
	* I can handle drops of files
	This.OLEDropHasData = 1
	This.OLEDropEffects = 1
   ENDCASE

ENDIF
And the drag and drop event
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord

LOCAL aFiles[ 1 ], nFiles, i, cExt
IF  oDataObject.GetFormat( 15 ) 
   * I can handle file data
   * Get the file data into an array 
   IF oDataObject.GetData( 15, @aFiles )
	* If we got any set the count
	nFiles = alen( aFiles, 1 ) 
   ELSE
	* Set the count to 0
	nFiles = 0
   ENDIF
   * Check each of the files
   FOR i = 1 to nFiles
	* Get the extension
	cExt = Upper( JustExt( aFiles[ i ] ))
	IF ( cExt == "BMP" ) or ( cExt == "JPG" ) or ( cExt == "GIF" )
		* If it is a file we can handle
		* Hide the label
		This.lblDropSpace.Visible = .F.
		* Set the picture property
		This.Picture = aFiles[ i ]
		* Draw he container
		THIS.Draw
		* Pause for a few seconds in case there was more than one file
		INKEY(2,"H")
	ENDIF
   ENDFOR
   * Set the copy only attribute
   nEffect = 1
   * stop the default action of this drag and drop
   NODEFAULT
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform