Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

OleDrag Sample (VB6)

This sample illustrates SftDirectory as a drop target (drag & drop).

This is not an executable sample, so a complete project is not provided. These statements are intended to show the syntax used.

Private Sub Form_Load()
    SftDirectory1.OLEDropMode = OLEDropSftControlManual
    SftDirectory1.AutoExpandDragDrop = True
End Sub

Private Sub SftDirectory1_OLEDragDrop(Data As SftDirectoryLib30.DataObject, _
        Folder As SftDirectoryLib30.ISftDirectoryFolder, Effect As Long, _
        Button As Integer, Shift As Integer, x As Single, y As Single, _
        DefaultHandling As Boolean)
    If Data.GetFormat(sftCFFiles) Then
        For i = 1 To Data.Files.Count
            MsgBox ("""" & Data.Files.Item(i) & """ being dropped.")
            ' perform your own processing here
        Next
    Else
        ' some other format
    End If
    ' make sure the control doesn't perform its usual default handling of
    ' the files (copy/move, etc.)
    DefaultHandling = False
End Sub

Private Sub SftDirectory1_OLEDragOver(Data As SftDirectoryLib30.DataObject, _
           Folder As SftDirectoryLib30.ISftDirectoryFolder, Effect As Long, _
           Button As Integer, Shift As Integer, x As Single, y As Single, _
           State As SftDirectoryLib30.SftControlOLEDragOverConstants, _
           DefaultHandling As Boolean)
    Effect = 0
    If Data.GetFormat(sftCFFiles) Then
        If Not Folder Is Nothing Then
            ' we'll accept anything
            Effect = vbDropEffectCopy Or vbDropEffectMove
        End If
    End If
    ' make sure the control doesn't perform its usual default handling of
    ' the files (copy/move, etc.)
    DefaultHandling = False
End Sub

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.