Results 1 to 3 of 3

Thread: Opening a file!

  1. #1

    Thread Starter
    Addicted Member trasher's Avatar
    Join Date
    Jun 2001
    Location
    Quebec city, Qc, Canada
    Posts
    255

    Angry Opening a file!

    Is it possible to open a file with spaces in it's name with the f***ing shell method without having to convert the name into his (MS-DOS) short spelling??

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    It should allow for that. I tried doing that in VB5 and it worked. Are you sure you have the right long file name?

    It's not hard to convert it. Just use this, and you don't have to worry at all. If this short path doesn't work, the file isn't there .

    VB Code:
    1. Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal strLongPath As String, ByVal strShortPath As String, ByVal lngBufferLength As Long) As Long
    2. Public Function ShortPath(ByVal strLongPath As String) As String
    3.    Dim strBuffer As String * 256
    4.    Dim lngLength As Long
    5.    lngLength = GetShortPathName(strLongPath, strBuffer, Len(strBuffer))
    6.    ShortPath = Left$(strBuffer, lngLength)
    7. End Function
    Last edited by Kaverin; Jul 4th, 2001 at 03:03 PM.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  3. #3

    Thread Starter
    Addicted Member trasher's Avatar
    Join Date
    Jun 2001
    Location
    Quebec city, Qc, Canada
    Posts
    255
    Thanks!
    It worked well!

    This function saves me a lot of time!

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