OK, on my XP PC GetSpecialFolder returns:
Exactly what I was expecting. Application Data is a HIDDEN folder by the way. Turn on view hidden files and folders in folder options if you haven't already. Oh wait, you are using Vista, well Vista virtualises to a hidden folder so maybe that's why you can't see the bullshite bit?
What exactly is the "Bullshite" part of the path?
On my Vista laptop it returns C:\ProgramData for me no problems.
Perhaps it's something to with what Budman says about once it's virtualised an exe it keeps on virtualising it and your test code exe is being virtualised for some reason because of some other stuff you are doing?
I've got no problem with switching to GetEnvironmentVar if there's a decent reason. But why are we getting inconsistent results?
Try running this:
It would really help my peace of mind to get to the bottom of why it doesn't work for you. Thanks for all your help! :-)
C:\Documents and Settings\All Users\Application Data\
Exactly what I was expecting. Application Data is a HIDDEN folder by the way. Turn on view hidden files and folders in folder options if you haven't already. Oh wait, you are using Vista, well Vista virtualises to a hidden folder so maybe that's why you can't see the bullshite bit?
What exactly is the "Bullshite" part of the path?
On my Vista laptop it returns C:\ProgramData for me no problems.
Perhaps it's something to with what Budman says about once it's virtualised an exe it keeps on virtualising it and your test code exe is being virtualised for some reason because of some other stuff you are doing?
I've got no problem with switching to GetEnvironmentVar if there's a decent reason. But why are we getting inconsistent results?
Try running this:
Strict Extern "win32" Function SHGetPathFromIDList(pidList, lpBuffer:Byte Ptr) Function SHGetSpecialFolderLocation(hwndOwner, nFolder, pIdl:Byte Ptr) End Extern Const CSIDL_COMMON_APPDATA = $23 ' ----------------------------------------------------------------------------- ' ccGetSpecialFolder: Returns a special Windows folder ' (By Dave Kirk) ' ----------------------------------------------------------------------------- Function ccGetSpecialFolder:String(folder_id) ?win32 Local idl:TBank = 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 ? Return "" End Function Print ccGetSpecialFolder(CSIDL_COMMON_APPDATA)
It would really help my peace of mind to get to the bottom of why it doesn't work for you. Thanks for all your help! :-)