*!* These constants are in (home() + 'foxpro.h') *!* #DEFINE CF_TEXT 1 *!* #DEFINE CF_FILES 15 *!* #DEFINE DROPEFFECT_NONE 0 *!* #DEFINE DROPEFFECT_COPY 1 *!* #DEFINE DROPEFFECT_MOVE 2 *!* #DEFINE DROPEFFECT_LINK 4 *!* #DEFINE DROPHASDATA_VFPDETERMINE -1 *!* #DEFINE DROPHASDATA_NOTUSEFUL 0 *!* #DEFINE DROPHASDATA_USEFUL 1 #INCLUDE foxpro.h #DEFINE CR chr(13) + chr(10) oForm = createobject('form1') oForm.Show(1) DEFINE CLASS form1 AS form DoCreate = .T. OLEDropMode = 1 Caption = "Drag-Drop Target Test Form" MaxButton = .F. MinButton = .F. Name = "Form1" ADD OBJECT edtresult AS editbox WITH ; OLEDropMode = 2, ; Height = 235, ; Left = 10, ; ReadOnly = .T., ; Top = 10, ; Width = 355, ; Name = "edtResult" PROCEDURE OLEDragDrop LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord local lcText lcText = '' do case case oDataObject.GetFormat(CF_FILES) * If there's been a file or filesd dropped get the file names local lcFileName, laFiles[1] =oDataObject.GetData(CF_FILES, @laFiles) if alen(laFiles) > 0 lcText = 'The following files were dropped:' for each lcFileName in laFiles lcText = lcText + CR + lcFileName endfor else lcText = 'No files were dropped on the form' endif case oDataObject.GetFormat(CF_TEXT) lcText = 'The following text was dropped on the form' + CR + ; oDataObject.GetData(CF_TEXT) otherwise lcText = 'No valid data found' endcase this.edtResult.Value = lcText ENDPROC PROCEDURE OLEDragOver LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState * if this is not the first time the event has fired, just return if nState <> 0 NODEFAULT return endif * check out the contents of the data object and enable them if it's appropriate do case oDataObject.GetDataFormat(CF_FILES) or oDataObject.GetDataFormat(CF_TEXT) this.oleDropHasData = DROPHASDATA_USEFUL this.OLEDropEffects = DROPEFFECT_COPY + DROPEFFECT_MOVE + DROPEFFECT_LINK otherwise this.oleDropEffects = DROPHASDATA_NOTUSEFUL this.OLEDropEffects = DROPEFFECT_NONE endcase ***** * GOT TO HAVE THIS, OTHERWISE VFP OVERRIDES ALL YOUR GOOD WORK! ***** NODEFAULT ENDPROC ENDDEFINEHTH