Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drag files from my app to Explorer
Message
De
17/04/2006 15:24:54
 
 
À
16/04/2006 12:50:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01113932
Message ID:
01114134
Vues:
37
This message has been marked as the solution to the initial question of the thread.
>Any suggestions on how I could have my VFP application expose internally
>managed files to Windows' shell for purposes of OLE drag and drop?
>
>Specifically, I would like to have users be able to drag an item from a
>grid or listbox, have my application translate the item(s) to full file
>path name(s) to files our application is managing, notify Windows that
>the drag contains file references (full paths), and then perform a file
>copy, move, or delete when dropped.
>
>The Solution Samples have some drag and drop code, but nothing that
>describes how to accomplish this scenario.
>
>Thanks,
>Malcolm

I drag/drop from a VFP app grid to a CD burner program.

In the Grid.OLEStartDrag:
LPARAMETERS oDataObject, nEffect
*
* Set the format that the burner program will recognize (and will change the icon)
*
oDataObject.SetFormat(15)	&& Files  CF_DROP
This code is used to copy similar folder names as a group to the burner.
In the Grid.OLESetData:
LPARAMETERS oDataObject, eFormat
*
* Fired by the drop in the burner program, telling us what kind of data it expects
*
IF eFormat=15	&& Files CF_DROP
  *
  * Copy over as many pieces of folder for this cruncher as you can (if it exists)
  *
  DIMENSION aFolders[1]
  aFolders[1] = thisform.BurnSource + vInfo.Folder
  cFolder = LEFT(vInfo.Folder,4)
  SKIP 1 IN vInfo
  IF this.DragButton=1		&& Left button, do the rest of this folder for this date
    SCAN REST WHILE vInfo.Folder=cFolder
      nFldrs = ALEN(aFolders,1) + 1
      DIMENSION aFolders[nFldrs]
      aFolders[nFldrs] = thisform.BurnSource + vInfo.Folder
    ENDSCAN
  ENDIF
  *
  * Set the data that's passed via D&D and the format
  *
  oDataObject.SetData(@aFolders,eFormat)
  this.Refresh()
ENDIF
And in the Grid.MouseDown:
LPARAMETERS nButton, nShift, nXCoord, nYCoord
LOCAL nWhere
this.GridHitTest(nXCoord,nYCoord,@nWhere)
IF nWhere=3	&& must be on a cell
  this.DragButton = nButton
  IF INLIST(nButton,1,2) AND NOT ISNULL(vInfo.DifCount) AND vInfo.DifCount=0 AND NOT ISNULL(vInfo.GBDisk)
    *
    * Since grids can't do an Automatic D&D (.DragMode=1),  start it manually
    *
    this.OLEDrag(.t.)
  ELSE
   this.DragButton = 0		&& Let MouseMove handle it
  ENDIF
ENDIF
Grid also has .OLEDropMode=1 Enabled
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform