Results 1 to 2 of 2

Thread: Getting Old MS-DOS Filenames

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    2

    Question

    How do I retrieve the old MS-DOS type filename (blahbl~2.bla) from a selected file in a filebox? I could use the Left() function, but that wouldn't work if there were more than one files with the same first six letters and same extension. Is there a special API call that I could use? I'm unfamiliar with the Windows API. I've used it before, but not much.

    Thanks,
    Malduin

    VB6.0 Professional Ed.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Use the GetShortPathName function:
    Code:
    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
    Const MAX_PATH = 260
    Private Sub Form_Load()
        Dim sShortName As String * MAX_PATH
        GetShortPathName "C:\Program Files", sShortName, MAX_PATH
        MsgBox sShortName
    End Sub
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width