Newsgroup: it.comp.lang.visual-basic
Titolo: [?] Common dialog e selezione multipla

 Avrei bisogno di impostare la selezione multipla dei file
usando il comando ShowOpen del controllo common dialog.
Controlla se e` tutto a posto perche' ho aggiustato in fretta
un esempio a file singolo che avevo postato da poco. Se usi
VB6 usa Split al posto di vb4Split e, se vuoi, elimina qualche
variant.
Option Explicit
#Const OnTest = True
Private Const mc_strINITDIR$ = "C:\Documenti"
Public Function vb4Split( _
  ByVal String1 As String _
, ByVal String2 As String _
) As Variant
  Dim lngLen2     As Long
  Dim lngStart    As Long
  Dim lngNext     As Long
  Dim lngItem     As Long
  Dim varArray()  As Variant
  Let lngLen2 = Len(String2)
  If Left$(String1, lngLen2) <> String2 _
  Then _
    Let String1 = String2 & String1
  If Right$(String1, lngLen2) <> String2 _
  Then _
    Let String1 = String1 & String2
  Do
    Let lngNext _
      = InStr(lngStart + lngLen2 + 1, String1, String2)
    If lngNext Then
      ReDim Preserve varArray(lngItem)
      Let varArray(lngItem) _
        = Mid$( _
              String1 _
            , lngStart + lngLen2 + 1 _
            , lngNext - (lngStart + lngLen2 + 1))
      Let lngStart = lngNext - 1
      Let lngItem = lngItem + 1
    End If
  Loop While lngNext
  Let vb4Split = varArray
End Function
Private Sub Command1_Click( _
)
  Dim lngErr&, strPathName$, vntFileTitles, i%
  With CommonDialog1
    Let .CancelError = True
    On Local Error Resume Next
    Call .ShowOpen
    Let lngErr = Err.Number
    On Local Error GoTo 0
  End With
  With CommonDialog1
    Select Case lngErr
    Case 0
      Let strPathName = .filename
      If Len(.FileTitle) Then
        Let .InitDir _
          = Mid$( _
            strPathName _
          , 1 _
          , Len(strPathName) - Len(.FileTitle))
        Let .filename = .FileTitle
        #If OnTest Then
          Call MsgBox( _
              "File selezionato:" & vbCrLf & vbCrLf _
            & "Cartella:" & vbTab & .InitDir & vbCrLf _
            & "File:" & vbTab & .FileTitle _
            , vbInformation _
            , App.Title)
        #End If
      Else
        Let vntFileTitles = vb4Split(strPathName, vbNullChar)
        If Right$(vntFileTitles(0), 1) <> "\" _
        Then _
          Let vntFileTitles(0) = vntFileTitles(0) & "\"
        For i = 1 To UBound(vntFileTitles)
          Let vntFileTitles(i) _
            = vntFileTitles(0) & vntFileTitles(i)
          Debug.Print vntFileTitles(i)
        Next
      End If
    Case cdlCancel
      #If OnTest Then
        Call MsgBox( _
            "La richiesta di apertura file e` stata" _
          & " annullata." _
          , vbExclamation _
          , App.Title)
      #End If
    Case Else
      Call MsgBox( _
          "Errore #" & lngErr & ":" & vbCrLf & vbCrLf _
        & Error(lngErr) & "." _
        , vbCritical _
        , App.Title)
    End Select
  End With
End Sub
Private Sub Form_Load( _
)
  With CommonDialog1
    Let .DialogTitle = "Seleziona file"
    Let .InitDir = mc_strINITDIR
    Let .Filter _
      = "File JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" _
      & "File GIF (*.gif)|*.gif|" _
      & "Documenti di Word (*.doc)|*.doc|" _
      & "File dell'applicazione (*.doc;*.jpg;*.jpeg;*.gif)|" _
      & "*.doc;*.jpg;*.jpeg|" _
      & "Tutti i file (*.*)|*.*"
    Let .FilterIndex = 4
    Let .Flags _
      = cdlOFNAllowMultiselect _
      + cdlOFNExplorer _
      + cdlOFNFileMustExist _
      + cdlOFNHideReadOnly _
      + cdlOFNLongNames _
      + cdlOFNPathMustExist _
      + cdlOFNShareAware
  End With
End Sub
--
Ciao.
Maurizio

       + cdlOFNShareAware
' Piccolo particolare di grande importanza:(
'
    Let .MaxFileSize = 32767


Avrei bisogno di impostare la selezione multipla dei file usando il comando
ShowOpen del controllo common dialog.
Nessuno sa se č possibile e come?
Grazie 1000