很急的~我就使用该属性读取了几百个文件名,结果反应出来只有十来个文件名,我设置的MaxFileName大概有10240,有什么办法可以解决吗?换控件也行,或请教其他高效方法~

解决方案 »

  1.   

    '*** Start Code ****
        Option Explicit   Private Sub Command1_Click()
       Dim current As Integer
       Dim I As Integer
       Dim intIndex As Integer
       Dim iStart As Integer
       Dim FileNames$()
       Dim sFname As String
       Dim iEndPath As Integer   Text2.Text = ""
       With CommonDialog1
          .MaxFileSize = 2048   ' Set as appropriate
          .filename = ""
          .Filter = "All Files|*.*"
          .Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
          .ShowOpen
          sFname = .filename & vbNullChar
       End With   iEndPath = 1
       ' determine if multiple files were selected
       ' null delimiter is not inserted if only 1 file is selected
       If countDelimiters(sFname, vbNullChar) = 1 Then
          Do Until (iEndPath = 0)
             iStart = iEndPath + 1
             iEndPath = InStr(iEndPath + 1, sFname, "\")
          Loop
          ReDim Preserve FileNames(0)
          ' determine if root directory was selected - preserve the "\"
          If countDelimiters(sFname, "\") = 1 Then
             FileNames(0) = Mid(sFname, 1, iStart - 1)
          Else
             FileNames(0) = Mid(sFname, 1, iStart - 2)
          End If
       Else
          iStart = InStr(1, sFname, vbNullChar) + 1
          ReDim Preserve FileNames(0)
          FileNames(0) = Left(sFname, iStart - 2)
       End If   intIndex = 1
       For I = iStart To Len(sFname)
          If Mid(sFname, I, 1) = vbNullChar Then
            ReDim Preserve FileNames(intIndex)
            FileNames(intIndex) = Mid(sFname, iStart, I - iStart)
            iStart = I + 1
            intIndex = intIndex + 1
          End If
       Next I   ' display information in proper text box
       For I = 0 To UBound(FileNames)
          If I Then
             Text2.Text = Text2.Text & FileNames(I) & vbCrLf
          Else
             Text1.Text = FileNames(I)
          End If
       Next I   End Sub   Function countDelimiters(ByVal sFiles As String, _
          ByVal vSearchChar As Variant) As Integer    Dim iCtr As Integer
        Dim iResult As Integer    For iCtr = 1 To Len(sFiles)
            If Mid(sFiles, iCtr, 1) = vSearchChar Then iResult = iResult + 1
        Next iCtr    countDelimiters = iResult   End Function
       '*** End Code ***
      

  2.   

    用WebBrowser做浏览器,如何解决网站弹出窗体?
    我在窗体上放了一个WebBrowser控件,就可以浏览网站了,但是网站有一些弹出的窗体,却使用了系统默认的浏览器,既使用的IE作为弹出窗体的浏览器了。