Use Registry ? 
Author Message
 Use Registry ?

I have always used INI files as a way to store program settings. This INI
file was always stored in the app install directory.

Would it be better to use an INI file stored in the COMMON_APP_DATA folder
or just continue to use the registry via SaveSetting/GetSetting ?

(This is an attempt to become UAC compliant.)

TIA,

DanS



Thu, 09 Aug 2012 21:59:30 GMT  
 Use Registry ?

Quote:
> Would it be better to use an INI file stored in the COMMON_APP_DATA folder
> or just continue to use the registry via SaveSetting/GetSetting ?

> (This is an attempt to become UAC compliant.)

 That's virtually the same question asked by jpBless
3 posts back.


Thu, 09 Aug 2012 22:44:00 GMT  
 Use Registry ?


Quote:

>> Would it be better to use an INI file stored in the COMMON_APP_DATA
>> folder or just continue to use the registry via
>> SaveSetting/GetSetting ?

>> (This is an attempt to become UAC compliant.)

>  That's virtually the same question asked by jpBless
> 3 posts back.

Maybe, maybe not.

There's a caveat in my case that I didn't mention....

(This is the IP device config program I started last month.)

One of the things to be stored is the order of filenames in a sorted,
wait, not a sorted, but an ordered, Listbox. These file names can be
long, but I guess I'd say no one would probably type more that 50 or 60
characters, if that, but you never know. I'm expecting the user to enter
a descriptive name for the file....

ie- Config for Main Street Master Radio

I need to store the filenames only, and not the entire path, and this is
done to just save the order in with the entries are in the Listbox.

My thought is to.....

1) Retreive the names of the files from the INI or registry and enter
them in the listbox in the correct order.
2) Enum each listbox entry and check to be sure the file still exists in
the data dir.
3) Remove list entries of files that are no longer there.
4) Add any new files that may have not been saved in the ordered list
(although there should be none if all creating/deleting is done thru the
program, and not copied/pasted into the data dir thru Explorer.)

So I've now got let's say 50 file names, or each averaging 30 chars.

Do I.........

1) Save one long string into the registry using SaveSetting that I
concatenate from the listbox entries, comma delimited.

2) Save each individual filename into the registry as it's own setting
(could potentially be 100's of 'settings').

3) Save a list in an INI file.

From research, the limit to a string registry key is 64K bytes. While the
easiest may be to save all filenames to one comma-delimited string, and
then retreive then split, I have concerns of using such a large registry
string value, even if it doesn't go over 64K bytes in size.

There. A little more context to differentiate my question.

TIA,

DanS



Fri, 10 Aug 2012 00:07:58 GMT  
 Use Registry ?

Quote:

> From research, the limit to a string registry key is 64K bytes. While the
> easiest may be to save all filenames to one comma-delimited string, and
> then retreive then split, I have concerns of using such a large registry
> string value, even if it doesn't go over 64K bytes in size.

  That does seem like an awfully lot to be putting in
the Registry. But you can do it as separate values if
you decide to go that way.
  A common method MS uses is to use 1 value for each
name, then have a value that specifies the order those
values should be in:

value:      data:
1             "file1.txt"
2             "file2.txt"
3             "file3.txt"
Order       "231"

  That way you can change the name of the file in,
say, value 2 without needing to rebuild the whole
Registry key.

  In terms of permissions, you can use GetSetting/
SaveSetting. You can use HKCU\Software\YourCompany.
You can use App Data. You can use all users app data,
creating a subfolder on which you've set the permissions
to make it accessible....

  You're talking about common app data, so presumably
you want per-machine settings. (User App Data and
SaveSetting are saving only for the current user.)
For per-machine settings you have to set permissions
somewhere because the only place where everyone has
permission with UAC is the all users documents folder. So
you could use HKLM\Software\YourCompany and set the
permissions on that key. Or use all users app data\YourCompany
and set the permissions on that folder. Those would be
the 2 standard ways to do it, but whether you use a
standard method/location or not, the main thing is that
you'll need to set permissions.

  If you need code for setting permissions:

I looked into this when Vista first came out. I found
there are several systems for setting permissions. Some
of it is fairly complex. Some people are using hokey
methods like a commandline string to cacls.exe. After
looking around I came up with what seems to be a
relatively simple and dependable class. I use it with
my installer to first check for NTFS. If the system is
NTFS format I then set full permission on a program
Registry key under HKLM\Software, and on program
subfolders. If you want to stay "kosher" you could use
it to set permissions on your own program folder under
all users app data, then save settings files there. But
you need to do that during install, while you're running
under admin rights.

http://www.jsware.net/jsware/vbcode.php5#perms



Fri, 10 Aug 2012 00:47:59 GMT  
 Use Registry ?

Quote:

>I have always used INI files as a way to store program settings. This INI
>file was always stored in the app install directory.

>Would it be better to use an INI file stored in the COMMON_APP_DATA folder
>or just continue to use the registry via SaveSetting/GetSetting ?

I'm pretty sure, but not 100% positives, that COMMON_APP_DATA isn't
updatable by regular users in Windows Vista and newer.   It is
updatable by admins or install routines which run under admin
privileges.

Tony

--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
  updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/



Fri, 10 Aug 2012 06:26:36 GMT  
 Use Registry ?



Quote:

>>I have always used INI files as a way to store program settings. This INI
>>file was always stored in the app install directory.

>>Would it be better to use an INI file stored in the COMMON_APP_DATA folder
>>or just continue to use the registry via SaveSetting/GetSetting ?

> I'm pretty sure, but not 100% positives, that COMMON_APP_DATA isn't
> updatable by regular users in Windows Vista and newer.   It is
> updatable by admins or install routines which run under admin
> privileges.

> Tony

AFAIK, in Vista COMMON_APP_DATA is updatable but only by the user
who created the file. You could create a subfolder during setup of your app
and set it's permissions to read/write/change for all users. Another problem
with COMMON_APP_DATA: it's a hidden folder and not visible for users
over the network. So don't store a database there.
For Vista better use COMMON_DOCUMENTS instead.

Helmut.



Fri, 10 Aug 2012 19:43:51 GMT  
 Use Registry ?

Quote:
> Another problem
> with COMMON_APP_DATA: it's a hidden folder and not visible for users
> over the network. So don't store a database there.
> For Vista better use COMMON_DOCUMENTS instead.

That is explicitly why I WOULD put a database there.
The "app data" I store is for the app to use and access and manage.

If it is a document that the user has control over then it should go
into the documents folders.

I do create a shortcut for the user to access that folder for the few
occasions it is needed, but it is far from regular.

--

i-Catcher Development Team

iCode Systems



Fri, 10 Aug 2012 20:44:54 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Hiding files using registry

2. How to find location of program using registry?

3. Using registry to store and retrieve app settings

4. Dialup check using Registry

5. How can option be set in VBE using registry or Visual Bsic command - HELP

6. Advice on using registry

7. HELP: Using Registry (Other then DWORD/Strings)

8. launch application using registry??

9. Using Registry for Program Variables???

10. using registry to set and get connection info

11. Using registry for config info through Visual Basic

12. A Project USING REGISTRY

 

 
Powered by phpBB® Forum Software