Results 1 to 9 of 9

Thread: anybody know this?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Thumbs up anybody know this?

    Have you noticed when most programs are displaying long file paths that they truncate the middle and display the rest? Like so...
    Code:
    c:\programs\~\myapp.exe
    How do I do that one?
    thanks

  2. #2
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    well, u could use the api to get the DOS shortfilename...
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  3. #3
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    which, i found would be

    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    thanks I'll take a look

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    Originally posted by Skitchen8
    which, i found would be

    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
    that was it thanks

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Here is an alternative that is pretty cool looking.
    VB Code:
    1. Private Type RECT
    2.    left As Long
    3.    tOp As Long
    4.    Right As Long
    5.    Bottom As Long
    6. End Type
    7.  
    8. Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    9. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    10. Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
    11.  
    12. 'This code compacts a path to a file by inserting ellipsees (...).
    13. 'This can be very valuable when you want to show a path, but you do not have the room on
    14. 'your form to show the whole thing.
    15.  
    16. Private Function CompactedPath(lHwnd As Long, sPath As String) As String
    17. Dim tRect As RECT
    18. Dim lHdc As Long
    19.    GetClientRect lHwnd, tRect
    20.    lHdc = GetDC(lHwnd)
    21.    DrawText lHdc, sPath, -1, tRect, &H14020
    22.    CompactedPath = sPath
    23. End Function
    24.  
    25. 'Usage:   CompactedPath Picture1.hwnd, "C:\AAAAA\BBBBB\CCCCC\DDDDD\EEEEE\FFFFF.EXE"

  7. #7
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    Originally posted by jesus4u


    that was it thanks
    no problem...
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    Originally posted by Hack
    Here is an alternative that is pretty cool looking.
    VB Code:
    1. Private Type RECT
    2.    left As Long
    3.    tOp As Long
    4.    Right As Long
    5.    Bottom As Long
    6. End Type
    7.  
    8. Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    9. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    10. Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
    11.  
    12. 'This code compacts a path to a file by inserting ellipsees (...).
    13. 'This can be very valuable when you want to show a path, but you do not have the room on
    14. 'your form to show the whole thing.
    15.  
    16. Private Function CompactedPath(lHwnd As Long, sPath As String) As String
    17. Dim tRect As RECT
    18. Dim lHdc As Long
    19.    GetClientRect lHwnd, tRect
    20.    lHdc = GetDC(lHwnd)
    21.    DrawText lHdc, sPath, -1, tRect, &H14020
    22.    CompactedPath = sPath
    23. End Function
    24.  
    25. 'Usage:   CompactedPath Picture1.hwnd, "C:\AAAAA\BBBBB\CCCCC\DDDDD\EEEEE\FFFFF.EXE"

    I like this too but how come it doesn't work when I place it in the form load event?

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    can you modify it to accomodate a URL like this one?

    http://coralridge.org/crmresources.asp

    thanks

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