Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File (filename) dropping unto the _SCREEN object
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
File (filename) dropping unto the _SCREEN object
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01454355
Message ID:
01454355
Views:
191
Hi,

I am trying to enable the _SCREEN object so that it receives file names as an OLE Drop from a Windows Explorer Drag. I have no problems being able to do this unto a regular FORM, however, it is the main VFP SCREEN that I want to do this with. Running the code below doesn't result in errors but it also doesn't trigger anything.
_SCREEN.OLEDROPMODE = 1
*!*_SCREEN.OLEDROPEFFECTS = 4

oScrOleDrop = CREATEOBJECT("ScrOleDrop")
BINDEVENT(_SCREEN,"OLEDragDrop",oScrOleDrop,"OLEDRAGDROP")
BINDEVENT(_SCREEN,"OLEDragOver",oScrOleDrop,"OLEDRAGOVER")

DEFINE CLASS ScrOleDrop AS Custom
	PROCEDURE OLEDRAGDROP
	LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
	IF oDataObject.GETFORMAT(15) && File list from Windows Explorer
		LOCAL laFiles(1)
		oDataObject.GETDATA(15,@laFiles)
		FOR EACH lcFile IN laFiles
			WAIT WINDOW lcFile	&& For testing... will be substituted
		NEXT
	ENDIF
	ENDPROC

	PROCEDURE OLEDRAGOVER
	LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
	DO CASE
		CASE nState == 0	&& DRAG_ENTER
			IF oDataObject.Getformat(15)   && File list from Windows Explorer
				_SCREEN.OLEDropHasData = 1 && DROPHASDATA_USEFUL
				_SCREEN.OLEDropEffects = 4 && 1=Copy, 2=Move, 4=Link

				THIS.OLEDropHasData = 1 && DROPHASDATA_USEFUL
				THIS.OLEDropEffects = 4 && 1=Copy, 2=Move, 4=Link

				nEffect = 4
			ENDIF
		CASE nState == 1	&& DRAG_LEAVE
	*!*	CASE nState == DRAG_OVER
	*!*		WAIT WINDOW "Drag over"
	ENDCASE
	ENDPROC
ENDDEFINE
Next
Reply
Map
View

Click here to load this message in the networking platform