程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> Visual Basic語言 >> VB6 >> 取得File 8.3之文件名稱格式

取得File 8.3之文件名稱格式

編輯:VB6

說明

這就是在Dos底下的短檔名,可以透過GetShortPathName取得,範例程式如下

程式

'這個程式需要一個Command
Private Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long
Private Declare Function GetFullPathName Lib "kernel32" _
Alias "GetFullPathNameA" (ByVal lpFileName As String, _
ByVal nBufferLength As Long, ByVal lpBuffer As String, _
lpFilePart As Byte) As Long
Private Sub Command1_Click()
Dim aa As Long, pbase As Long
Dim FullPath As String, ShortPath As String
Dim SouStr As String
Dim len5 As Long
Dim fname() As Byte
Dim gg As String
SouStr = "D:\Program Files\Microsoft Visual Studio\VB98\vb6.exe"
ShortPath = String(255, 0)
aa = GetShortPathName(SouStr, ShortPath, 256)
SouStr = Left(ShortPath, InStr(1, ShortPath, Chr(0)) - 1)
Debug.Print SouStr
End Sub
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved