;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfGetLongPathNameA_V1 (strPath) intLength = DllCall (DirWindows (1) : "KERNEL32.DLL", long : "GetLongPathNameA", lpstr : strPath, lpnull, lpnull) If !intLength Then Return "" hdlBB = BinaryAlloc (intLength) BinaryEodSet (hdlBB, intLength) intLength = DllCall (DirWindows (1) : "KERNEL32.DLL", long : "GetLongPathNameA", lpstr : strPath, lpbinary : hdlBB, long : intLength) strLongPathName = BinaryPeekStr (hdlBB, 0, intLength) BinaryFree (hdlBB) Return strLongPathName #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfGetLongPathNameA_V2 (strPath) intLength = 260 ; MAX_PATH. hdlBB = BinaryAlloc (intLength) BinaryEodSet (hdlBB, intLength) intLength = DllCall (DirWindows (1) : "KERNEL32.DLL", long : "GetLongPathNameA", lpstr : strPath, lpbinary : hdlBB, long : intLength) strLongPathName = BinaryPeekStr (hdlBB, 0, intLength) BinaryFree (hdlBB) Return strLongPathName #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strTest111 = Environment ("TEMP") ; "C:\DOKUME~1\User\LOKALE~1\Temp" strTest112 = udfGetLongPathNameA_V1 (strTest111) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp" strTest121 = Environment ("TEMP") : "\" ; "C:\DOKUME~1\User\LOKALE~1\Temp\" strTest122 = udfGetLongPathNameA_V1 (strTest121) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp\" strTest131 = FileCreateTemp ("") ; "C:\DOKUME~1\User\LOKALE~1\Temp\E0.tmp" strTest132 = udfGetLongPathNameA_V1 (strTest131) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp\E0.tmp" strTest211 = Environment ("TEMP") ; "C:\DOKUME~1\User\LOKALE~1\Temp" strTest212 = udfGetLongPathNameA_V2 (strTest211) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp" strTest221 = Environment ("TEMP") : "\" ; "C:\DOKUME~1\User\LOKALE~1\Temp\" strTest222 = udfGetLongPathNameA_V2 (strTest221) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp\" strTest231 = FileCreateTemp ("") ; "C:\DOKUME~1\User\LOKALE~1\Temp\E1.tmp" strTest232 = udfGetLongPathNameA_V2 (strTest231) ; "C:\Dokumente und Einstellungen\User\Lokale Einstellungen\Temp\E1.tmp" Exit