#AdditionalJar: jna-4.5.0
#AdditionalJar: jna-platform-4.5.0
'usage:
Log(GetShortPathName("C:\Users\H\Downloads\xCustomListView.zip"))
Sub GetShortPathName(Path As String) As String
Dim jo As JavaObject
jo = jo.InitializeStatic("com.sun.jna.platform.win32.Kernel32").GetField("INSTANCE")
Dim buffer(256) As Char
Dim res As Int = jo.RunMethod("GetShortPathName", Array(Path, buffer, buffer.Length))
If res = 0 Then
Return Path 'failed
End If
Dim sb As StringBuilder
sb.Initialize
For i = 0 To res - 1
sb.Append(buffer(i))
Next
Return sb.ToString
End Sub