|
-
Apr 2nd, 2002, 01:44 PM
#1
Thread Starter
PowerPoster
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
-
Apr 2nd, 2002, 01:45 PM
#2
Frenzied Member
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
-
Apr 2nd, 2002, 01:45 PM
#3
Frenzied Member
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
-
Apr 2nd, 2002, 01:46 PM
#4
Thread Starter
PowerPoster
-
Apr 2nd, 2002, 01:52 PM
#5
Thread Starter
PowerPoster
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
-
Apr 2nd, 2002, 02:00 PM
#6
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"
-
Apr 2nd, 2002, 02:02 PM
#7
Frenzied Member
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
-
Apr 2nd, 2002, 02:17 PM
#8
Thread Starter
PowerPoster
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?
-
Apr 2nd, 2002, 02:25 PM
#9
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|