Have you noticed when most programs are displaying long file paths that they truncate the middle and display the rest? Like so...
How do I do that one?Code:c:\programs\~\myapp.exe
thanks
Printable View
Have you noticed when most programs are displaying long file paths that they truncate the middle and display the rest? Like so...
How do I do that one?Code:c:\programs\~\myapp.exe
thanks
well, u could use the api to get the DOS shortfilename...
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
thanks I'll take a look
that was it thanksQuote:
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
Here is an alternative that is pretty cool looking.VB Code:
Private Type RECT left As Long tOp As Long Right As Long Bottom As Long End Type Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long 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 'This code compacts a path to a file by inserting ellipsees (...). 'This can be very valuable when you want to show a path, but you do not have the room on 'your form to show the whole thing. Private Function CompactedPath(lHwnd As Long, sPath As String) As String Dim tRect As RECT Dim lHdc As Long GetClientRect lHwnd, tRect lHdc = GetDC(lHwnd) DrawText lHdc, sPath, -1, tRect, &H14020 CompactedPath = sPath End Function 'Usage: CompactedPath Picture1.hwnd, "C:\AAAAA\BBBBB\CCCCC\DDDDD\EEEEE\FFFFF.EXE"
no problem...Quote:
Originally posted by jesus4u
that was it thanks
Quote:
Originally posted by Hack
Here is an alternative that is pretty cool looking.VB Code:
Private Type RECT left As Long tOp As Long Right As Long Bottom As Long End Type Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long 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 'This code compacts a path to a file by inserting ellipsees (...). 'This can be very valuable when you want to show a path, but you do not have the room on 'your form to show the whole thing. Private Function CompactedPath(lHwnd As Long, sPath As String) As String Dim tRect As RECT Dim lHdc As Long GetClientRect lHwnd, tRect lHdc = GetDC(lHwnd) DrawText lHdc, sPath, -1, tRect, &H14020 CompactedPath = sPath End Function '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?
can you modify it to accomodate a URL like this one?
http://coralridge.org/crmresources.asp
thanks