forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Does "INFO @windir(Common AppData)" work for you?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu Nov 08, 2007 11:04 pm    Post subject: Does "INFO @windir(Common AppData)" work for you? Reply with quote

Say, does anyone get an error or data returned when using the following with VDS 5.x

INFO @windir(Common AppData)

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
trapper
Contributor
Contributor


Joined: 28 Jan 2005
Posts: 112
Location: Brisbane, Australia

PostPosted: Fri Nov 09, 2007 2:54 am    Post subject: Reply with quote

I've never heard of 'Common AppData'.

Try the following to see what parameters to the @windir() function are available:
Code:
list create, 1
list regvals,1,HCU,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
info @text(1)

_________________
John Trappett
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Nov 09, 2007 11:32 am    Post subject: Reply with quote

Garrett,

You may be better off using an API function to get the paths to the special
system folders.

Code:
SHGetSpecialFolderPath(
    HWND hwndOwner, // window for displaying message boxes on error
    LPTSTR lpszPath, // address of buffer to recieve path. Must be atleast 260 chars in size
    int nFolder, // CSIDL of special folder of interest
    BOOL fCreate // if TRUE, the folder will be created if it doesn't exist
);


is the API to use for getting special system paths. This API is defined in the
shlobj.h header file and is in the Shell32.dll for systems other than
Windows 2000, where it's in the shlwapi.dll.

The CSIDL value (int nFolder) for Common AppData is -> 35.
HWND hwndOwner can be set to NULL.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Nov 09, 2007 2:50 pm    Post subject: Reply with quote

Garrett,
Try this code.

Code:

#-----------------------------------------------------------------------------#
#                                                                             #
# A user defined function showing how to get a special folder path            #
#                                                                             #
# Author:  Johnny Kinsey                                                      #
#                                                                             #
# Copyright: Copyright © 2007 DragonSphere Software                           #
#                                                                             #
#-----------------------------------------------------------------------------#

#DEFINE FUNCTION,GETSPECIALFOLDER
Title Get Special Folders
Info @GetSpecialFolder(PERSONAL)@cr()@GetSpecialFolder(APPDATA)@cr()

# Will only work with XP and above.
%%CDBURN_AREA = @GetSpecialFolder(CDBURN_AREA)
If @Null(%%CDBURN_AREA)
  %A = @Ask(Would you like me to create a CDBURN AREA Folder?)
  If %A
    Info @GetSpecialFolder(CDBURN_AREA,1)@cr()
  End
End
Exit

:GetSpecialFolder
  %R =
  LoadLib shell32.dll
  LoadLib user32.dll
  %S = 2
 # *** Define Special Folder Constants
 If @Equal(%1,PROGRAMS)
   #Program Groups Folder
   %S = 2   
 ElsIf @Equal(%1,PERSONAL)
   #Personal Documents Folder
   %S = 5
 ElsIf @Equal(%1,FAVORITES)
   #Favorites Folder
   %S = 6
 ElsIf @Equal(%1,STARTUP)
   #Startup Group Folder
   %S = 7
 ElsIf @Equal(%1,RECENT)
   #Recently Used Documents Folder
   %S = 8
 ElsIf @Equal(%1,SENDTO)                 
   #Send To Folder
   %S = 9
 ElsIf @Equal(%1,STARTMENU)
   #Start Menu Folder
   %S = 11
 ElsIf @Equal(%1,MYDOCUMENTS)
   #My Documents folder
   %S = 12
 ElsIf @Equal(%1,MYMUSIC)
   #My Music folder
   %S = 13
 ElsIf @Equal(%1,MYVIDEO)
   #My Video folder
   %S = 14
 ElsIf @Equal(%1,DESKTOPDIRECTORY)
   #Desktop Folder
   %S = 16
 ElsIf @Equal(%1,NETHOOD)
   #Network Neighborhood Folder
   %S = 19
 ElsIf @Equal(%1,TEMPLATES)
   #Document Templates Folder
   %S = 21
 ElsIf @Equal(%1,COMMON_STARTMENU)
   #Common Start Menu Folder
   %S = 22
 ElsIf @Equal(%1,COMMON_PROGRAMS)
   #Common Program Groups Folder
   %S = 23
 ElsIf @Equal(%1,COMMON_STARTUP)
   #Common Startup Group Folder
   %S = 24
 ElsIf @Equal(%1,COMMON_DESKTOPDIRECTORY)
   #Common Desktop Folder
   %S = 25
 ElsIf @Equal(%1,APPDATA)
   #Application Data Folder
   %S = 26
 ElsIf @Equal(%1,PRINTHOOD)
   #Printers Folder
   %S = 27
 ElsIf @Equal(%1,COMMON_FAVORITES)
   #Common Favorites Folder
   %S = 31
 ElsIf @Equal(%1,INTERNET_CACHE)
   #Temporary Internet Files Folder
   %S = 32
 ElsIf @Equal(%1,COOKIES)
   #Cookies Folder
   %S = 33
 ElsIf @Equal(%1,HISTORY)
   #History Folder
   %S = 34
 ElsIf @Equal(%1,COMMON_APPDATA)
   #Common Application Data Folder
   %S = 35
 ElsIf @Equal(%1,WINDOWS)
   # Windows folder
   %S = 36
 ElsIf @Equal(%1,SYSTEM)
   # System folder
   %S = 37
 ElsIf @Equal(%1,PROGRAM_FILES)
   # Program Files folder
   %S = 38
 ElsIf @Equal(%1,MYPICTURES)
   # My Pictures folder
   %S = 39
 ElsIf @Equal(%1,PROFILE)
   #Profiles folder
   %S = 40
 ElsIf @Equal(%1,SYSTEMX86)
   #System folder on the X86 platform
   %S = 41
 ElsIf @Equal(%1,PROGRAM_FILESX86)
   #Program Files folder on the X86 platform
   %S = 42
 ElsIf @Equal(%1,PROGRAM_FILES_COMMON)
   #Common Program Files folder
   %S = 43
 ElsIf @Equal(%1,PROGRAM_FILES_COMMONX86)
   #Common Program Files folder on the X86 folder
   %S = 44
 ElsIf @Equal(%1,COMMON_TEMPLATES)
   #Common templates folder
   %S = 45
 ElsIf @Equal(%1,COMMON_DOCUMENTS)
   #Common My Documents folder
   %S = 46
 ElsIf @Equal(%1,COMMON_ADMINTOOLS)
   #Common Admin Tools folder
   %S = 47
 ElsIf @Equal(%1,ADMINTOOLS)
   #Admin Tools folder
   %S = 48
 ElsIf @Equal(%1,CONNECTIONS)
   #Connections folder
   %S = 49
 ElsIf @Equal(%1,COMMON_MUSIC)
   #Common My Music folder
   %S = 53
 ElsIf @Equal(%1,COMMON_PICTURES)
   #Common My Pictures folder
   %S = 54
 ElsIf @Equal(%1,COMMON_VIDEO)
   #Common Video folder
   %S = 55
 ElsIf @Equal(%1,CDBURN_AREA)
   #CDBurn Area folder
   %S = 59
 Else
   If %1
     %S = %1
   End
 End
 
 %A = @fill(4096,,Z)
 If %2
   %2 = 1
 Else
   %2 =
 End
 %Z = @lib(shell32,SHGetSpecialFolderPathA,BOOL,INT:@lib(user32,GetDesktopWindow,INT),INT:@addr("%A"),INT:%S,BOOL:%2)
 If %Z
   %R = @Trim(%A)
 End
 FreeLib Shell32
 FreeLib user32
Exit %R


Sorry Bill but this is VDS not C Wink

Hey Garrett I thought you stopped using VDS Question Hmmm looks like VDS 6 demos Wink

Updated to correctly handle the option to create the folder if it does not exist.

_________________
Home of

Give VDS a new purpose!


Last edited by vdsalchemist on Fri Nov 09, 2007 10:41 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Nov 09, 2007 3:39 pm    Post subject: Reply with quote

BTW normally in C or C++ I use the function SHGetSpecialFolderLocation and extract the location from the PIDL with SHGetPathFromIDList. This way I can also get Virtual folders that are not file system folders.
_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Fri Nov 09, 2007 7:58 pm    Post subject: Reply with quote

Well I'm using the registry at the moment to get the path, it's under Local Machine, but I thought the VDS function would get this also, but seems not.

I'd prefer not to read from the registry at all, but rather use an api and let the OS itself bang it's head on getting the info.

And no, nothing to do with VDS 6, not any demo, and I didn't even beta test VDS 6. I'm simply converting some of my older VDS code to compensate for Vista, so need to move ini files and such into the Application Data folders. But in this case, I needed it to be available for all users and not just the current user, which is what @windir(AppData) will get you.

Such as this screensaver I've been sitting on since like 2003 here...
http://www.paraboliclogic.com/programs/pixelateddreams/
Now i've updated it to use the "\All Users\Application Data" so that all users on a single machine will have access to my screensaver without any issues, except that if they change the settings, then all users have to deal with it.. LOL Oh well. Wink

Anyway, thanks everyone for the suggestions/ideas. Much appreciated.
~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Nov 09, 2007 8:07 pm    Post subject: Reply with quote

dragonsphere wrote:
Sorry Bill but this is VDS not C Wink


Johnny,

Since I'm not a registered VDS 5 user, I'd didn't figure it appropriate to
post code to accomplish this task. However, if you hadn't and I was asked
for an example of usage, I would have. Your function does however simplify
things for everyone else Wink, ie; no searching for CSIDL values.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Nov 09, 2007 10:04 pm    Post subject: Reply with quote

Garrett wrote:
Well I'm using the registry at the moment to get the path, it's under Local Machine, but I thought the VDS function would get this also, but seems not.

I'd prefer not to read from the registry at all, but rather use an api and let the OS itself bang it's head on getting the info.


Garrett,
Didn't you see my code above? You don't need to use the registry at all. I wrote the code to use the API.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Fri Nov 09, 2007 10:43 pm    Post subject: Reply with quote

Hi All,
I have updated the code above to handle creating the requested folder if it does not exist.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Nov 10, 2007 3:52 am    Post subject: Reply with quote

dragonsphere, yeah, sorry, I meant to say thanks for that... Thanks Smile
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Nov 10, 2007 3:54 am    Post subject: Reply with quote

On the note about XP and above, is that just for the CD Burn section, or all the code?
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sat Nov 10, 2007 11:38 pm    Post subject: Reply with quote

Garrett,
Some of these directories are only found on newer versions of Windows and CDBURN is one of them. I am pretty sure the code will work on any version of Windows if it has IE 5+ installed. I just have not tested it on other versions of Windows.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group