使用按钮控制listview浏览不同的文件夹。有图标,并可执行文件夹内所有文件。不用右键。在线等待。

解决方案 »

  1.   

    不用右键啥意思?我做过很多treeview + listview ,应该不难就是我不明白楼主的需求
      

  2.   

    用listview 浏览文件夹,同时可以鼠标双击listview内的文件执行。
    必须有图标显示。
      

  3.   

    用listview 浏览文件夹,同时可以鼠标双击listview内的文件执行。
    必须有图标显示。在listview控件中不能修改文件名。
      

  4.   

    一定要用listview吗?不是有Dirlistbox和filelistbox?如果一定要用,可以用Api函数,不过我没有用过。要不就用更笨的方法:遍历所有文件及文件夹来添加了。
    至于双击执行,只有读出文件名,再判断后缀名,用Shell函数运行。
      

  5.   

    UFSOIC.OpenFileSystemObject Me, 5    '这个方法有问题正在解决...
    什么意思?在什么情况下会出错?
      

  6.   

    Surpass(“凌寒”☆☆☆☆☆ ← 别急,还没变红) sorry
    如果不要显示文件的后缀名,该如何办?
      

  7.   

    UFSOIC.OpenFileSystemObject Me, 5    '这个方法有问题正在解决...
    什么意思?在什么情况下会出错?
    答:打开没有关联的文件会出错!!!
    如果不要显示文件的后缀名该怎么做?
    答:如下
    Public Function GetExtension(Filename As String)
    Dim i, j, PthPos, ExtPos As IntegerFor i = Len(Filename) To 1 Step -1 ' Go from the Length of the filename, to the first character by 1.
        If Mid(Filename, i, 1) = "." Then ' If the current position is '.' then...
            ExtPos = i ' ...Change the ExtPos to the number.
            For j = Len(Filename) To 1 Step -1 ' Do the Same...
                If Mid(Filename, j, 1) = "\" Then ' ...but for '\'.
                    PthPos = j ' Change the PthPos to the number.
                    Exit For ' Since we found it, don't search any more.
                End If
            Next j
            Exit For ' Since we found it, don't search any more.
        End If
    Next iIf PthPos > ExtPos Then
    Exit Function ' No extension.
    Else
    If ExtPos = 0 Then Exit Function ' If there is not extension, then exit sub.
    GetExtension = Mid(Filename, ExtPos + 1, Len(Filename) - ExtPos) 'Messagebox the Extension
    End IfEnd Function
    '使用:
    'FileExt = GetExtension("c:\windows\vb\vb.exe")
    如何判别双击的时候是否点中其中的文件?
    答:这个问题与我的控件没有关系,你看一下listview的相关事件,可能需要自己定义一个事件。