January 1, 2005

WinTask - PathCompactPathEx

'
' PathCompactPathEx - Shorten a path, showing as many "meaningful" characters as possible
'
' Author: Joe Strazzere
'

' "shlwapi.dll" Alias "PathCompactPathExA"
' (ByVal pszOut As String,
'  ByVal pszSrc As String,
'  ByVal cchMax As Long,
'  ByVal dwFlags As Long) As Long
dim ptr as unsigned
ptr=allocate(255)
inputpath$="c:\testing1\testing2\testing3\testing3.txt"
limit=20
ret=External("shlwapi.dll", "PathCompactPathExA", ptr, inputpath$, limit, 0)
var$=peekstring$(ptr)
msgbox(inputpath$+crlf+crlf+"    compacted to "+Str$(limit)+" characters is:"+crlf+crlf+var$,0,"PathCompactPathEx")