VB6 Registry - basic.visual
This is a discussion on VB6 Registry - basic.visual ; I have a VB6 app which stores values in the windows registry.
Different users use the app so I want to store the registry settings
as an **.ini file in the respective user's data directory. When the
respective user logs ...
-
VB6 Registry
I have a VB6 app which stores values in the windows registry.
Different users use the app so I want to store the registry settings
as an **.ini file in the respective user's data directory. When the
respective user logs on, his user settings are loaded in the windows
registry. When he logs off the app, I want to save the user settings
in his config file. The appname is "Cry Uncle", and there are many
section names under the appname. Below is an example of saving just
two of the sections. To save all the sections, there are many
For_Next loops. I think there has to be a more efficient way to take
the registry data under "Cry Uncle" and write it to a config file
without using many loops. I can delete all registry settings under
"Cry Uncle" by one simple command -- DeleteSetting "Cry Uncle". How
do I use one GetAllSettings command loop for all the sections under
the appname? I don't want to specify each section as doing below.
Dim MySettings As Variant, intSettings As Integer, s$
Close #1
kill App.Path & "\" & "Configuration.ini"
Open App.Path & "\" & "Configuration.ini" For Append As #1
s$ = "Fatso"
MySettings = GetAllSettings(appname:="Cry Uncle", section:=s$)
For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
1)
Write #1, s$; MySettings(intSettings, 0), MySettings(intSettings,
1)
Next intSettings
s$ = "Skinny"
MySettings = GetAllSettings(appname:="Cry Uncle", section:=s$)
For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
1)
Write #1, s$; MySettings(intSettings, 0), MySettings(intSettings,
1)
Next intSettings
Close #1
'Wipe out all the registry settings
DeleteSetting "Cry Uncle"
-
Re: VB6 Registry
thinker@NotThinker.toy's wild thoughts were released on Thu,
05 Jul 2007 07:02:39 -0500 bearing the following fruit:
>I have a VB6 app which stores values in the windows registry.
>Different users use the app so I want to store the registry settings
>as an **.ini file in the respective user's data directory. When the
>respective user logs on, his user settings are loaded in the windows
>registry. When he logs off the app, I want to save the user settings
>in his config file. The appname is "Cry Uncle", and there are many
>section names under the appname.
I'm not clear on why you want to move away from the
registry? You seem to imply it's because different users are
using the app, in which case the registry works just as
well.
J
>Below is an example of saving just
>two of the sections. To save all the sections, there are many
>For_Next loops. I think there has to be a more efficient way to take
>the registry data under "Cry Uncle" and write it to a config file
>without using many loops. I can delete all registry settings under
>"Cry Uncle" by one simple command -- DeleteSetting "Cry Uncle". How
>do I use one GetAllSettings command loop for all the sections under
>the appname? I don't want to specify each section as doing below.
>
>Dim MySettings As Variant, intSettings As Integer, s$
>Close #1
>kill App.Path & "\" & "Configuration.ini"
>Open App.Path & "\" & "Configuration.ini" For Append As #1
>
>s$ = "Fatso"
>MySettings = GetAllSettings(appname:="Cry Uncle", section:=s$)
>For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
> 1)
> Write #1, s$; MySettings(intSettings, 0), MySettings(intSettings,
>1)
>Next intSettings
>
>s$ = "Skinny"
>MySettings = GetAllSettings(appname:="Cry Uncle", section:=s$)
>For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
> 1)
> Write #1, s$; MySettings(intSettings, 0), MySettings(intSettings,
>1)
>Next intSettings
>Close #1
>
> 'Wipe out all the registry settings
>DeleteSetting "Cry Uncle"
--
Jan Hyde
https://mvp.support.microsoft.com/profile/Jan.Hyde
-
Re: VB6 Registry
On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
<StellaDrinker@REMOVE.ME.uboot.com> wrote:
>thinker@NotThinker.toy's wild thoughts were released on Thu,
>05 Jul 2007 07:02:39 -0500 bearing the following fruit:
>
>>I have a VB6 app which stores values in the windows registry.
>>Different users use the app so I want to store the registry settings
>>as an **.ini file in the respective user's data directory. When the
>>respective user logs on, his user settings are loaded in the windows
>>registry. When he logs off the app, I want to save the user settings
>>in his config file. The appname is "Cry Uncle", and there are many
>>section names under the appname.
>
>I'm not clear on why you want to move away from the
>registry? You seem to imply it's because different users are
>using the app, in which case the registry works just as
>well.
Because the settings for each user is different. If there are 30
users, and each has diffent values for each setting, there is no way
to store all that under one appname called "Cry Uncle". The most
efficient way is to load the registry when the user logs on. I can't
seem to find an efficient way to take the settings from the registry
and place them in a config file without using a lot of loops. Has to
be a more efficient means.
-
Re: VB6 Registry
<thinker@NotThinker.toy> wrote in message
news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>
>
> Because the settings for each user is different. If there are 30
> users, and each has diffent values for each setting, there is no way
> to store all that under one appname called "Cry Uncle".
To the contrary, that is just what the registry does. The app settings are
stored in the current user part of the registry, which is different for each
user that logs onto the machine. They each get to set their own wallpaper, too,
using the same mechanism.
-
Re: VB6 Registry
On Thu, 05 Jul 2007 14:58:38 GMT, wrote:
> On Thu, 5 Jul 2007 07:50:35 -0700, "Steve Gerrard"
> <mynamehere@comcast.net> wrote:
>
>><thinker@NotThinker.toy> wrote in message
>>news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
>>> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
>>> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>>>
>>> Because the settings for each user is different. If there are
>>> 30 users, and each has diffent values for each setting, there is
>>> no way to store all that under one appname called "Cry Uncle".
>>
>>To the contrary, that is just what the registry does. The app
>>settings are stored in the current user part of the registry,
>>which is different for each user that logs onto the machine. They
>>each get to set their own wallpaper, too, using the same
>>mechanism.
>
> You are talking about LUA of XP. The users do not individually
> log into the PC. Each user just logs into the "Cry Uncle" app.
> That is why I have to download the registry settings to the
> individual config file. But, how do I do this efficiently without
> a lot of loops?
Why not just make subkeys? Something like:
HKCU\Software\Cry Uncle\User Profiles\Tom
HKCU\Software\Cry Uncle\User Profiles\Dick
HKCU\Software\Cry Uncle\User Profiles\Harry
(Or HKLM instead of HKCU.)
--
auric dot auric at gmail dot com
*****
Rage... rising...
--
Posted via a free Usenet account from http://www.teranews.com
-
Re: VB6 Registry
On Thu, 5 Jul 2007 07:50:35 -0700, "Steve Gerrard"
<mynamehere@comcast.net> wrote:
>
><thinker@NotThinker.toy> wrote in message
>news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
>> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
>> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>>
>>
>> Because the settings for each user is different. If there are 30
>> users, and each has diffent values for each setting, there is no way
>> to store all that under one appname called "Cry Uncle".
>
>To the contrary, that is just what the registry does. The app settings are
>stored in the current user part of the registry, which is different for each
>user that logs onto the machine. They each get to set their own wallpaper, too,
>using the same mechanism.
>
>
You are talking about LUA of XP. The users do not individually log
into the PC. Each user just logs into the "Cry Uncle" app. That is
why I have to download the registry settings to the individual config
file. But, how do I do this efficiently without a lot of loops?
-
Re: VB6 Registry
thinker@NotThinker.toy's's wild thoughts were released on
Thu, 05 Jul 2007 09:58:38 -0500 bearing the following fruit:
>On Thu, 5 Jul 2007 07:50:35 -0700, "Steve Gerrard"
><mynamehere@comcast.net> wrote:
>
>>
>><thinker@NotThinker.toy> wrote in message
>>news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
>>> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
>>> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>>>
>>>
>>> Because the settings for each user is different. If there are 30
>>> users, and each has diffent values for each setting, there is no way
>>> to store all that under one appname called "Cry Uncle".
>>
>>To the contrary, that is just what the registry does. The app settings are
>>stored in the current user part of the registry, which is different for each
>>user that logs onto the machine. They each get to set their own wallpaper, too,
>>using the same mechanism.
>>
>>
>
>You are talking about LUA of XP. The users do not individually log
>into the PC. Each user just logs into the "Cry Uncle" app. That is
>why I have to download the registry settings to the individual config
>file. But, how do I do this efficiently without a lot of loops?
Presumably your only going to do it once?
Anyhoo if your going to be using ini files you might find
the following useful
http://vbnet.mvps.org/code/file/pprofilebasic.htm
--
Jan Hyde
https://mvp.support.microsoft.com/profile/Jan.Hyde
-
Re: VB6 Registry
On Thu, 05 Jul 2007 16:46:19 +0100, "Jan Hyde (VB MVP)"
<StellaDrinker@REMOVE.ME.uboot.com> wrote:
>thinker@NotThinker.toy's's wild thoughts were released on
>Thu, 05 Jul 2007 09:58:38 -0500 bearing the following fruit:
>
>>On Thu, 5 Jul 2007 07:50:35 -0700, "Steve Gerrard"
>><mynamehere@comcast.net> wrote:
>>
>>>
>>><thinker@NotThinker.toy> wrote in message
>>>news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
>>>> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
>>>> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>>>>
>>>>
>>>> Because the settings for each user is different. If there are 30
>>>> users, and each has diffent values for each setting, there is no way
>>>> to store all that under one appname called "Cry Uncle".
>>>
>>>To the contrary, that is just what the registry does. The app settings are
>>>stored in the current user part of the registry, which is different for each
>>>user that logs onto the machine. They each get to set their own wallpaper, too,
>>>using the same mechanism.
>>>
>>>
>>
>>You are talking about LUA of XP. The users do not individually log
>>into the PC. Each user just logs into the "Cry Uncle" app. That is
>>why I have to download the registry settings to the individual config
>>file. But, how do I do this efficiently without a lot of loops?
>
>Presumably your only going to do it once?
>
>Anyhoo if your going to be using ini files you might find
>the following useful
>
>http://vbnet.mvps.org/code/file/pprofilebasic.htm
What is shown does not retrieve all secions of an appname. I want all
the sections and Keys under the appname with one command.
-
Re: VB6 Registry
On Thu, 05 Jul 2007 09:58:38 -0500, thinker@NotThinker.toy's wrote:
>On Thu, 5 Jul 2007 07:50:35 -0700, "Steve Gerrard"
><mynamehere@comcast.net> wrote:
>
>>
>><thinker@NotThinker.toy> wrote in message
>>news:810q83phvuln8v41j3ji2rd56po7fhocco@4ax.com...
>>> On Thu, 05 Jul 2007 14:23:31 +0100, "Jan Hyde (VB MVP)"
>>> <StellaDrinker@REMOVE.ME.uboot.com> wrote:
>>>
>>>
>>> Because the settings for each user is different. If there are 30
>>> users, and each has diffent values for each setting, there is no way
>>> to store all that under one appname called "Cry Uncle".
>>
>>To the contrary, that is just what the registry does. The app settings are
>>stored in the current user part of the registry, which is different for each
>>user that logs onto the machine. They each get to set their own wallpaper, too,
>>using the same mechanism.
>>
>>
>
>You are talking about LUA of XP. The users do not individually log
>into the PC. Each user just logs into the "Cry Uncle" app. That is
>why I have to download the registry settings to the individual config
>file. But, how do I do this efficiently without a lot of loops?
Going at it sideways, you have the user sign on name, so why not modify the
Line
MySettings = GetAllSettings(appname:="Cry Uncle", section:=s$)
to
MySettings = GetAllSettings(appname:="Cry Uncle" & s$, section:="Main")
or similar?
Richard
Web pages: http://www.caravanningnow.co.uk/ for caravanning,
http://www.rcole.org/ for my personal web site and
http://www.homeindorset.co.uk because I love the email address.
--
GAMBLERS. For a new gambling opportunity, try sending £50 to yourself by Royal
Mail. - 'Viz' top tip
Similar Threads
-
By Application Development in forum labview
Replies: 0
Last Post: 10-09-2007, 10:10 AM
-
By Application Development in forum DOTNET
Replies: 1
Last Post: 09-19-2007, 08:18 AM
-
By Application Development in forum Clipper
Replies: 46
Last Post: 04-19-2007, 06:33 PM
-
By Application Development in forum DOTNET
Replies: 2
Last Post: 03-09-2007, 02:31 PM
-
By Application Development in forum Clarion
Replies: 0
Last Post: 01-13-2006, 05:02 AM