You are not logged in.

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

1

Thursday, August 13th 2009, 11:38pm

Drag'n'Drop, Files from Windows-Explorer into your prog (aka OLEDragDrop)

Hi,

if you want to drag'n'drop files from the windows-Explorer into your program, in order to open the file you maybe do it this way in VB6:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'Properties:
'.OLEDragMode = 1 - Automatic ' = vbOLEDragAutomatic
'.OLEDropMode = 1 - Manually  ' = vbOLEDropManual
Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
   AllOLEDragDrop Data
End Sub
Private Sub StatusBar1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
   AllOLEDragDrop Data
End Sub
Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
   AllOLEDragDrop Data
End Sub
Private Sub AllOLEDragDrop(Data As DataObject)
   If Data.GetFormat(vbCFFiles) Then
      Dim FileName 'As String
      'only one file:
      FileName = Data.Files(1) 'one based
      MsgBox FileName
      'or all files
      For Each FileName In Data.Files
         MsgBox FileName
      Next
   End If
End Sub


The following constants are involved:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Enum OLEDragConstants
   vbOLEDragManual = 0
   vbOLEDragAutomatic = 1
End Enum
Enum OLEDropConstants
   vbOLEDropNone = 0
   vbOLEDropManual = 1
   vbOLEDropAutomatic = 2
End Enum
Enum OLEDropEffectConstants
   vbDropEffectNone = 0
   vbDropEffectCopy = 1
   vbDropEffectMove = 2
   vbDropEffectScroll = &H80000000 '-2147483648
End Enum
Enum CClipBoardConstants
   vbCFText = 1
   vbCFBitmap = 2
   vbCFMetafile = 3
   vbCFDIB = 8
   vbCFPalette = 9
   vbCFEMetafile = 14
   vbCFFiles = 15
   vbCFLink = &HFFFFBF00 '-16640
   vbCFRTF = &HFFFFBF01  '-16639
End Enum




Question:

what do you think, is it important to implement all of this stuff?


normally what you need is vbCFFiles for dropping files from the windows-Explorer into your program.
The rest is only very rarely used i guess.



this one could be useful to implement this feature in Jabaco:
FileDrop




OlimilO

Rate this thread
WoltLab Burning Board