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.

Code Snippets / Get Windows special folder locations [DBP]

Author
Message
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th May 2006 02:07
Want to know where windows is installed on a users pc, or what folder is for their desktop. Then use this code I've knocked up.



Boo!
CodemanV
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 4th May 2006 03:19
Hello - good little function that.

Hope you don't mind, I modified your code a bit to implement the <Make Memory> command and use memory pointers instead of using memblocks.

Memblocks are very handy but sometimes just a simple pointer or two will do the job also.

It's always nice to know there's more than one way to do a particular task

Still though, good snippet!

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th May 2006 12:38
I'm still learning how to use memblocks, pointers and memory commands, but it is good to know we have a choice. For me it just makes more logical sense to use memblocks and you get more functions to play with memblocks.

I started off with the delete memblock commands in the 'end' function as I was worried they would not clear down correctly between calls, but your code proves that it is ok. I also had a 'start' function but scrapped it and made main routine detect if dll was loaded or not, but it should be more efficient your way.

Thanks for the tips.

Boo!
Olby
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 4th May 2006 14:38
Im sorry but there already is a windir$ command in DBP that will return corrrect windows directory.

"Gangsters die, they don't go to heaven where angels fly!"
AMD Sempron 3.1+ Ghz, 512MB Ram, ATI R9550 256MB Ram, Sound Blaster Live!, WinXP SP2, DirectX 9.0c
CodemanV
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 4th May 2006 15:05
@Spooky - I use memblocks for sounds, objects, images, custom data types, etc. and I use pointers for smaller tasks. Both of them deal with memory and do the same job so it's just a matter of what some one feels more comfortable with.

The main advantage of memblocks is that they already have functions for objects/meshes/sound/images and they also convert memory floats.

@Olby - Try geting your "My Documents" or "Desktop" path with DBP.

There are at least 21 Special Folder paths in XP and DBP returns just the Windows path <windir$>.

Different people will have different paths depending on what Windows version being used. Others change the special folders default paths for security or personal preference reasons.

There have been a few queries lately on the DBP forum about finding these folders, usually when someone is trying to code an installer for their game/package.

Spooky's function is handier than it looks.

Login to post a reply

Server time is: 2024-11-23 07:50:39
Your offset time is: 2024-11-23 07:50:39