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的相关事件,可能需要自己定义一个事件。
必须有图标显示。
必须有图标显示。在listview控件中不能修改文件名。
至于双击执行,只有读出文件名,再判断后缀名,用Shell函数运行。
什么意思?在什么情况下会出错?
如果不要显示文件的后缀名,该如何办?
什么意思?在什么情况下会出错?
答:打开没有关联的文件会出错!!!
如果不要显示文件的后缀名该怎么做?
答:如下
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的相关事件,可能需要自己定义一个事件。