Private Declare Function PathFindFileName Lib "shlwapi.dll" Alias "PathFindFileNameA" _
(ByVal pPath As String) As Long
Private Declare Function lstrcpy Lib "kernel32.dll" _
(ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" _
(ByVal lpString As Any) As Long
Private Declare Function PathFindExtension Lib "shlwapi.dll" Alias "PathFindExtensionA" _
(ByVal pPath As String) As Long
Private Sub Form_Load()
Dim temp As String, pPoint As Long, rc, FileName As String
Me.Text1(0).Text = "c:\windows\notepad.exe"
FileName = Me.Text1(0).Text
temp = String(256, Chr(0))
pPoint = PathFindFileName(FileName)
rc = lstrlen(pPoint)
Call lstrcpy(temp, pPoint)
Me.Text1(1).Text = temp
pPoint = PathFindExtension(FileName)
rc = lstrlen(pPoint)
Call lstrcpy(temp, pPoint)
Me.Text1(2).Text = temp
End Sub |