Widowns User Profile Path

Hi Guys
Again sorry for the screw up in posting the whole digest again but
please remember i am just a dizzy girl. Now need to implement a saved game
file, no problem i hear you say, but on windows vista i can not write the
file in the game directory i must write it to the usersProfile space
typically C:\Documents and settings\UserName\MyGameName\ so i believe i need
to call some windows functions like

HRESULT SHGetFolderPath(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);
i have included “SDL_syswm.h” which gives me a data structure for
SDL_SysWMinfo
but how do i fill the structure out?
how do i get HWND and the CSIDL (nFolder) value typically CSIDL_PERSONAL
or CSIDL_PROGRAM_FILES or CSIDL_APPDATA.

Or have i totally missed the point about the whole Shebang? by the way i
think this is down to my Vista crash i reported a while back, as i believe i
cant write to the game DIR because of some security permissions on Visa.

Trish (dizzy girl but no dumb blond)

You don’t need to tell the Win32 API anything about window handles to
get the path. Something like this should do it:

SHGetFolderPath(NULL,CSIDL_APPDATA,NULL, 0,cSomeBuffer);

This will give you a path like “C:\Documents and
Settings\foobar\Application Data”. Use CSIDL_COMMON_APPDATA if you
want to get something like “C:\Documents and Settings\All
Users\Application Data” instead.

By the way, maybe you need to #include <shlobj.h> to get it to work.
Don’t know if the SDL .h-file does that for you.On 3/8/07, Patricia Curtis <patricia.curtis at gmail.com> wrote:

HRESULT SHGetFolderPath(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);
i have included “SDL_syswm.h” which gives me a data structure for
SDL_SysWMinfo but how do i fill the structure out?
how do i get HWND and the CSIDL (nFolder) value typically CSIDL_PERSONAL or
CSIDL_PROGRAM_FILES or CSIDL_APPDATA.


Cheers,
Rasmus Neckelmann

HRESULT SHGetFolderPath(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);

If you’re looking for a platform independant way to do this,
http://www.maccormack.net/~djm/fnkdat provides a wrapper around this
for *NIX and Windows.

DaveOn Tue, 13 Mar 2007, Rasmus Neckelmann wrote:

On 3/8/07, Patricia Curtis <patricia.curtis at gmail.com> wrote:


David MacCormack
@David_MacCormack

David MacCormack ha scritto:

If you’re looking for a platform independant way to do this,
http://www.maccormack.net/~djm/fnkdat provides a wrapper around this
for *NIX and Windows.

interesting project, but quite old…

I don’t know if it works on XP (I suppose yes)

but surely doesn’t on Vista, as Paulo Pinto says:

"
Here you can get a full info how this process works on
vista. They are only enforcing what used to be a recommended
practice for XP, that few software houses did follow:

http://msdn2.microsoft.com/en-us/library/aa480150.aspx
http://msdn2.microsoft.com/en-us/library/aa905330.aspx
"–
SkunkGuru

[…]

Why are you saying this? Microsoft surely didn’t change the calls to
find the current user’s home directory, or else everything would’ve
been broken in Vista.On 3/17/07, SkunkGuru wrote:

David MacCormack ha scritto:

If you’re looking for a platform independant way to do this,
http://www.maccormack.net/~djm/fnkdat provides a wrapper around this
for *NIX and Windows.

interesting project, but quite old…

I don’t know if it works on XP (I suppose yes)

but surely doesn’t on Vista, as Paulo Pinto says:

  • SR