Public Function GetFileIcoKey(strFileName As String) As String
'返回文件类型对应的图标Key
Dim strExName As String, nInstr As Integer
Dim strAudio As String, strVideo As String
。。。。。。。。。。。。。。。。。。。。。。。。。。
strAudio = "|aac|mid|midi|mod|mp3|mpa|ape|ra|rm|ram|tta|wav|wma|m3u|ttpl"
strVideo = "|asf|avi|wmv|wm|mpeg|mpg|mp4|m1v|rmvb"
。。。。。。。。
strExName = LCase(objFSO.GetExtensionName(strFileName))
If Len(strExName) <= 0 Then
GetFileIcoKey = "undef"
Exit Function
End If
nInstr = InStr(1, strAudio, strExName)
If nInstr <> vbNull And nInstr > 1 Then
GetFileIcoKey = "aud"
Exit Function
End If
nInstr = InStr(1, strVideo, strExName)
'问题出在下面这句,在监视窗口中显示nInstr=6,但就是不执行IF内的语句,其IF都正常,就这一个有问题,我搞了一晚上没搞定
If nInstr <> Null And nInstr > 1 Then
GetFileIcoKey = "video"
Exit Function
End If
……………………
……………………
GetFileIcoKey = "undef"
End Function
各位高手,请赐教
參考答案:If nInstr <> vbNull And nInstr > 1 Then
GetFileIcoKey = "video"
Exit Function
End If