Re: Reg/INI Discussion from much earlier
From: Bob Butler (tiredofit_at_nospam.com)
Date: 07/27/04
- Next message: Steven Burn: "Re: Reg/INI Discussion from much earlier"
- Previous message: Rick: "txt box won't validate"
- In reply to: YYZ: "Re: Reg/INI Discussion from much earlier"
- Next in thread: YYZ: "Re: Reg/INI Discussion from much earlier"
- Reply: YYZ: "Re: Reg/INI Discussion from much earlier"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Jul 2004 14:18:43 -0700
"YYZ" <notapplicable> wrote in message
news:eG1f51BdEHA.3596@tk2msftngp13.phx.gbl
> "Bob Butler" <tiredofit@nospam.com> wrote in message
> news:eQraCIBdEHA.3260@TK2MSFTNGP09.phx.gbl...
>> "Wes Spikes" <MornThdr@NOSPAMverizon.net> wrote in message
>> news:f9yNc.12829$Nu4.4912@nwrddc01.gnilink.net
>>> I HATE it when windows crashes after whatever you're wokring on on
>>> changing and i lose all changes and apps can't tell you anything
>>> except settings are corrupt.
>>
>> I do too which is why I generally update saved settings whenever
>> they are changed, not just when the app terminates. That eliminates
>> almost all chance of them being lost especially under NT-based OS's.
>
> I hate jumping on a thread midstream to ask a question, but Bob you
> seem to one of the proponents of ini files vs. registry. I currently
> store a bunch o stuff in the registry, and I'd like to write a
> function to take that and put it in an ini file. I'm not asking you
> how to enum registry keys or anything, but I was wondering about the
> structure of an ini file. Let's say I wanted to store the
> top/left/width/height of multiple forms, along with a few general
> settings. Would you recommend this structure?
>
> [General Settings]
> lastusername=tim
> recalconclose=yes
>
> [frmEstimateMaster]
> left=90
> top=0
> width=6000
> height=4800
>
> [frmSomethingelse]
> left=XX
> top=0
> width=XX
> height=XX
That works... if you have a lot of forms you can reduce the size with
something like:
[screenstate]
frmEstimateMaster_Top=0
frmEsimateMaster_Left=90
frmEstimateMaster_Height=4800
frmEstimateMaster_Width=6000
frmSomethingElse_Top=100
frmSomethingElse_Left=400
frmSomethingElse_Height=4000
frmSomethingElse_Width=3000
or even more if you do:
[screenstate]
frmEstimateMaster=90,0,6000,4800
frmSomethingElse=400,100,3000,4000
if you want to handle multiple users with different settings either use a
user-specific path for the INI file or append it to the section name (e.g.
[screenstate tim]). I try to keep the size of INI files to a minimum.
> I'll have to do some research into finding what happens if a section
> doesn't exist already, if a key doesn't exist already, etc. but I'll
> do that -- not looking for examples, more of a theory answer.
The GetPrivateProfileString and WritePrivateProfileString API calls will
essentially handle those issues for you.
-- Reply to the group so all can participate VB.Net... just say "No"
- Next message: Steven Burn: "Re: Reg/INI Discussion from much earlier"
- Previous message: Rick: "txt box won't validate"
- In reply to: YYZ: "Re: Reg/INI Discussion from much earlier"
- Next in thread: YYZ: "Re: Reg/INI Discussion from much earlier"
- Reply: YYZ: "Re: Reg/INI Discussion from much earlier"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|