XP下测试的话,必须用有效的路径。
Dim $lShortPath
Dim $lLongPath="C:\Documents and Settings\Administrator\Application Data"
Dim $iLongPathLength=StringLen($lLongPath)
$iLongPathLength+=1
Dim $tLongPath=DllStructCreate("wchar["&$iLongPathLength&"]")
Dim $pLongPath=DllStructGetPtr($tLongPath)
DllStructSetData($tLongPath,1,$lLongPath)
Dim $iShortPathLength=StringLen($lLongPath)
$iShortPathLength+=1
Dim $tShortPath=DllStructCreate("wchar["&$iShortPathLength&"]")
Dim $pShortPath=DllStructGetPtr($tShortPath)
Dim $iResult=DllCall("Kernel32.dll","DWORD","GetShortPathNameW","ptr",$pLongPath,"ptr",$pShortPath,"DWORD",$iShortPathLength)
MsgBox(0,"",DllStructGetData($tShortPath,1))
|