Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DLL option to retrieve user folder name...

Author
Message
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 23rd Sep 2006 21:30 Edited at: 23rd Sep 2006 23:24
This request is for DBC.

I've searched the forums and haven't been able to locate a function to do this, namely to retrieve the folder name of the current user. I suspect the function will be possible using kernel32.dll and will return C:\Documents and Settings\(UserName) in XP and C:\Users\(UserName) in Vista. I've tried a few routines, but can't get anything to work. Any help is greatly appreciated.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 24th Sep 2006 16:11
I posted a DBPro routine that did exactly that;

http://forum.thegamecreators.com/?m=forum_view&t=78254&b=6

What you need to do for it to work in DBC is anyones guess.

PS Value 40 (decimal) or 0x0028 (Hex) is the value that returns profile folder.

From MS help;

Quote: "
CSIDL_PROFILE (0x0028)
Version 5.0. The user's profile folder. A typical path is C:\Documents and Settings\username. Applications should not create files or folders at this level; they should put their data under the locations referred to by CSIDL_APPDATA or CSIDL_LOCAL_APPDATA.
"


Boo!
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 24th Sep 2006 21:07
Interesting, thank you. With a little modification, it should be possible to run it in classic (mostly just things like removing unnecessary variable declarations). I guess shell32.dll was the way to go. Thanks again.

SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 24th Sep 2006 21:33
Unfortunately, this routine does not work with Vista. In fact, value 40 returns no value at all. So I guess I'll need to manually hunt down needed directories in code.

Applications can't even edit files in their own program directory under Vista (because of the new UAC conditions), which creates a problem for a lot of programs. You either have to use the compatibility mode and select 'Run as Administrator' or manage files in an approved area of the hard drive. Goodie

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 24th Sep 2006 23:05
OK. I've not tried Vista yet at all, but I've just been reading some articles about UAC such as this;

http://www.regdeveloper.co.uk/2006/09/22/vista_for_developers/

and it sounds like a lot of old apps may stuggle with the new way of doing things.

Boo!
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 25th Sep 2006 00:54 Edited at: 25th Sep 2006 01:55
Yup, I think the UAC conditions (which are really limitations) will pose a much greater problem for applications than any DirectX issues will. Applications get the wrong results when detecting, deleting, editing, and creating their own data files with the forced-automated-redirection-to-a-user-folder 'fix' that Microsoft employed. The end result is, applications can't save what they need to because Vista tells the app the files exists in the program's folder, but it won't let it do anything to them, and then redirects to the user folder aren't updated because Vista doesn't auto-route file detection, it only auto-routes file edits and deletes. I can't even estimate how many applications I have that don't work on Vista because of this very problem.

For my DB stuff, I've had to completely re-write the data file saving/editing system to be compatible with Vista.

Login to post a reply

Server time is: 2025-05-18 03:03:35
Your offset time is: 2025-05-18 03:03:35