And what do you use to retrieve the ProgramData folder? It's going to be called different things depending on the Windows install language, so you need to get it properly.
This works:?Win32 Extern "win32" Function SHGetSpecialFolderLocation(hwndOwner, nFolder, pIdl:Byte Ptr) Function SHGetPathFromIDList( pidList ,lpBuffer:Byte Ptr) End Extern ? Const CSIDL_LOCAL_APPDATA = $1C Const CSIDL_COMMON_APPDATA = $23 Function GetSpecialFolder:String(folder_id) Local idl% = CreateBank (8) Local pathbank:TBank = CreateBank (260) If SHGetSpecialFolderLocation(0,folder_id,BankBuf(idl)) = 0 SHGetPathFromIDList PeekInt( idl,0), BankBuf(pathbank) Return String.FromCString(pathbank.Buf()) + "" EndIf End Function
CSIDL_COMMON_APPDATA is just a constant with a value of $23. You can give the constant any name you want and the above code is still going to work.