Re: Drag a file(path) from an Access Form into another app?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thought I'd have a bash at this myself, will this work for you?
(ListView0 is the ListView control from Windows Common Controls 6)

Option Compare Database
Option Explicit
Const vbCFFIles = 15
Const vbCFText = 1

Dim lCurX, lCurY As Single

Private Sub Form_Load()
Dim lstitem As ListItem
Set lstitem = ListView0.Object.ListItems.Add()
lstitem.Text = "Sample.txt"
lstitem.Key = "Fullpath\Sample.txt"
End Sub

Private Sub ListView0_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As Long, ByVal y As Long)
lCurX = x
lCurY = y
End Sub

Private Sub ListView0_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As Long, ByVal y As Long)
If Button = 1 Then
ListView0.OLEDrag
End If
End Sub


Private Sub ListView0_OLEStartDrag(Data As Object, AllowedEffects As Long)
On Error GoTo ListView0_OLEStartDrag_Err
Dim oDrag As ListItem
Set oDrag = ListView0.HitTest(lCurX, lCurY)

If oDrag Is Nothing Then
AllowedEffects = ccOLEDropEffectNone
Else
AllowedEffects = ccOLEDropEffectCopy
Call Data.SetData(oDrag.Text, vbCFText)
Call Data.SetData(, vbCFFIles)
Call Data.Files.Add(oDrag.Key)
End If
Exit Sub
ListView0_OLEStartDrag_Exit:
Exit Sub
ListView0_OLEStartDrag_Err:
MsgBox Err.Number & ": " & Err.Description
Resume ListView0_OLEStartDrag_Exit
End Sub

HTH

"roger" <roger@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B5A2A13B-5B9A-4BA1-AC46-104321885436@xxxxxxxxxxxxxxxx
Hi Stuart, At least you're involved in "possiblity thinking."

I've simulated drag and drop in Access before, but that isn't my goal. The
goal here is to actually use Windows drag and drop, and not have to write
custom procedures for every app the user could drop on. (just let windows
do
it)

If it helps I'm using MSA 2007 which totally supports drag and drop, you
can
drag tables and queries out to excel or word, and drop excel ranges in as
tables, so it IS in there.

If there is really NO way to do it in a form, then I am thinking that a
custom control is the answer. (I can't write one, but I would pay to have
it
written) just a transparent button with three events, click, double click
and
drag, and programmable value. With no other to drag data out of an Access
app, maybe I could sell the control.

Damn this is fustrating, from what I read, in .Net, this is as simple as
setting .DragBehavoir = enabled.



.



Relevant Pages

  • RE: Drag & Drop in ListBox Ctrl: Find pointer position on mouse up
    ... It is fantastique, I am going now to add the drag and drop bits, and we'll ... This control is much more flexible that the regular Listbox: ... Private Sub Lvw_ItemClick ... Dim THT As LVHITTESTINFO ...
    (microsoft.public.excel.programming)
  • Re: Drag a file(path) from an Access Form into another app?
    ... Only thing is I'm not using a .Listview control. ... picturebox, image, and textbox, all support OLE drag and drop. ... Private Sub ListView0_MouseDown(ByVal Button As Integer, ...
    (microsoft.public.access.formscoding)
  • Re: tkdnd within a text widget with blinking cursor
    ... Not really :-) Update idletasks is supposed to handle idle events, ... Actually, I develop first on Windows, and check only ... takes control of the event loop only under ... Just drag some text from the drag sources ...
    (comp.lang.tcl)
  • Re: tkdnd within a text widget with blinking cursor
    ... Under windows, my code does not take control, but passes ... Just drag some text from the drag sources ... and thus the tk's event loop is running. ...
    (comp.lang.tcl)
  • Re: Drag and Drop a Folder?
    ... I have an application that will traverse a directory and process files ... I want to be able to have the application accept a drag and drop of a ... do the same for any control which supports OleDropMode, ... Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As ...
    (comp.lang.basic.visual.misc)