Peter, your code isn't taking in cosideration the 0 end string returned by the API.
If function works fine like this:
If function works fine like this:
Function GetSpecialFolder:String(folder_id) Local idl:TBank = CreateBank (8) Local pathbank:TBank = CreateBank (260) Local n% Local sp$ If SHGetSpecialFolderLocation(0,folder_id,BankBuf(idl)) = 0 SHGetPathFromIDList PeekInt( idl,0), BankBuf(pathbank) For n= 0 To 259 local BufByte:byte =PeekByte(pathbank,n) if bufbyte <>0 then sp$ = sp$ + Chr(bufbyte) else exit endif Next EndIf return (trim(sp$) + "") End Function