那位知道为什么我用 App.EXEName ,有时能正确得到长文件名,有时却只能得到DOS的8.3各式的文件名?先用20分,解决后再加分!

bgxy 2002-09-05 01:54:11
如题。
而且我用
Open MyFilePathName For Binary As #fileNum
写文件时,也是有时得到的是8.3格式的文件名,MyFilePathName是我想保存的文件的完整路径文件名。
...全文
39 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2002-09-05
  • 打赏
  • 举报
回复
you can always convert it into long file name using a function like
(from http://216.26.168.92/tips/tip511.html)

Public Function GetLongFileName(ByVal ShortFileName As String) As String

Dim intPos As Integer
Dim strLongFileName As String
Dim strDirName As String

'Format the filename for later processing
ShortFileName = ShortFileName & "\"

'Grab the position of the first real slash
intPos = InStr(4, ShortFileName, "\")

'Loop round all the directories and files
'in ShortFileName, grabbing the full names
'of everything within it.

While intPos

strDirName = Dir(Left(ShortFileName, intPos - 1), _
vbNormal + vbHidden + vbSystem + vbDirectory)

If strDirName = "" Then
GetLongFileName = ""
Exit Function
End If

strLongFileName = strLongFileName & "\" & strDirName
intPos = InStr(intPos + 1, ShortFileName, "\")

Wend

'Return the completed long file name
GetLongFileName = Left(ShortFileName, 2) & strLongFileName

End Function
wxyq 2002-09-05
  • 打赏
  • 举报
回复
用vb6+sp4 /sp5 就可以
================================================================

ok?
bgxy 2002-09-05
  • 打赏
  • 举报
回复
订正,用Open MyFilePathName For Binary As #fileNum保存时,完成后我到那个路径去看看,发现文件名不是长文件名,像[我的文~1.dat]一样

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧