SHGetFolderPath Causes exception
Posted on 2007-04-11
In an attempt to make my software more Vista compatable, I am using SHGetFolderPath to get the AppData folder so I can then create a subfolder and write to it.
Now, my application has two forms, on the first form I have this in the oncreate method in the first form.
If SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, P) = S_OK then
gbSavePath := P + '\MySubFolder\';
gbSavePath := GetCurrentDir;
yes I have added SHFolder to the uses clause, and the oncreate method on the second form is blank.
now, i know that gbSavePath gets set with the correct location, but when my secord for is created - an exception occurs.
I comment that code above, and everything runs fine.