Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making application Vista ready?
Message
From
22/09/2006 14:16:27
 
 
To
22/09/2006 13:31:40
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01156172
Message ID:
01156582
Views:
13
You'll need to verify that this still works in Vista as My Documents goes away.

>Hi John,
>
>I was only recommending a different way of finding what the APPDATA environment variable had in it.
>
>hese are the constants for determining various folders:
>
>
>#DEFINE CSIDL_PERSONAL                  0x0005        && My Documents
>#DEFINE CSIDL_APPDATA                   0x001a        && <user name>\Application Data
>#DEFINE CSIDL_PROGRAM_FILES_COMMON      0x002b        && C:\Program Files\Common
>#DEFINE CSIDL_COMMON_APPDATA            0x0023        && All Users\Application Data
>#DEFINE CSIDL_WINDOWS                   0x0024        && GetWindowsDirectory()
>#DEFINE CSIDL_SYSTEM                    0x0025        && GetSystemDirectory()
>#DEFINE CSIDL_PROGRAM_FILES             0x0026        && C:\Program Files
>#DEFINE CSIDL_LOCAL_APPDATA             0x001c        && <user name>\Local Settings\Applicaiton Data (non roaming)
>#DEFINE CSIDL_FLAG_CREATE       		0x8000		  && create folder if not there
>
>
>and you just do this to find out what the value is:
>
>
>?m.loSystem.GetFolder(CSIDL_APPDATA, .F.)
>
>
>
>>Hi Frank
>>Thanks for the tip on the "constants", but I think I like the APPDATA environmental variable better because they can't change that one and it is consistent between XP and Vista.
>>
>>We did some checking of other Windows versions and although APPDATA does not exist in some of them, we still think that it's the one to use because the majority of our users are using XP.
>>
>>Best, John
>>
>>>Hi John,
>>>
>>>I have used one of the FFC classes to determine particular folders on user pcs, for similar reasons of not knowing if I'd be able to write to the Program Files folder.
>>>
>>>Here's some sample code which you may consider as an alternative (but of course this may have changed under vista as well):
>>>
>>>
>>>#DEFINE CSIDL_PERSONAL 0x0005 && My Documents
>>>
>>>* assuming _System.VCX is in the set classlib statement
>>>m.loSystem = CREATEOBJECT("_CommonFolder")
>>>m.lcMyDocuments = m.loSystem.GetFolder(CSIDL_PERSONAL, .F.)
>>>
>>>
>>>I'm sure you can find the other constants to get the other user folders.
>>>
>>>>We recently installed Vista RC1 and tested an application that we distribute and immediately ran into problems. Naturally, the UAC (User Access Control) is the problem that we did not anticipate or even know about until we installed Vista.
>>>>
>>>>For those that are familiar with the problems that UAC can cause, it appears that you should be developing your apps to run for "standard users" instead of "administrators". In the XP world, seems like everyone was an administrator and Vista is going to change this.
>>>>
>>>>In short, no more writing to the "Program Files" or "Windows" folder; and no more registry changes UNLESS you want to logon as an administrator to do this.
>>>>
>>>>We've decided to try and modify our apps so that they will run in XP or Vista without any special code or even knowing if they are in Vista. Here is what we determined.
>>>>
>>>>I know Rick Strahl (correct me if I'm wrong here Rick) suggested using
>>>>SYS(2023) to determine the folder to your application system files. Currently, these are being stored in the application folder in Program Files... which is a big no-no under Vista.
>>>>
>>>>In our testing, SYS(2023) did not give us consistent results. In XP, on one occasion it was returning the C:\ folder. Conceivably, this was due to a setting in the config.fpw or an application config.??? file. We decided that this was too difficult to control because what is returned by SYS(2023) could be changed by a setting in the config.??? file.
>>>>
>>>>After reviewing the environmental variables that exist in both Windows XP and Vista, it looks like the ones that will give us what we are looking for is either the APPDATA or USERPROFILE environmental variable.
>>>>
>>>>The following shows an example of what we would do if using the APPDATA variable to determine where our applications system files should be created.
>>>>
>>>>In Win XP, Appdata returns ...
>>>>
>>>>C:\Document and Settings\UserName\ApplicationData
>>>>
>>>>In Vista, it returns
>>>>
>>>>C:\Users\UserName\AppData\Roaming
>>>>
>>>>(Note: We'd probably strip off the "Roaming" so as not to run into problems with roaming profiles, and append on "Local" to save in the Local application data folder.)
>>>>
>>>>To this we would create a folder for our application and store our application files that the user creates when running the application in that folder.
>>>>
>>>>
>>>>Here is an example of how this would work:
>>>>
>>>>User name is: John
>>>>Application Prefix is: JJF
>>>>
>>>>If running in XP we would save our application system files in:
>>>>
>>>>C:\Document and Settings\John\ApplicationData\JJF
>>>>
>>>>
>>>>If running Vista, we would save our application system files in:
>>>>
>>>>C:\Users\John\AppData\Local\JJF
>>>>
>>>>
>>>>If anyone else has given any serious thought to this, I'd sure love to hear your comments.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform