Results 1 to 9 of 9

Thread: what is advantage to write to registry

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Springfield
    Posts
    120

    what is advantage to write to registry

    Why we want to write to registry. We can just build a table in database and track each user's info. But I saw a lot of program try to write to registry? Can anyone explain? Thanks
    MM

  2. #2
    WALDO
    Guest

    Cool Typically because its simpler

    Back in the olden days, program settings were stored in .ini files that were read in, either by a programmer-developed roputine, or API calls to read INI's.

    Then came the registry...a giant store of information that can be shared and is located in a single place.

    With databases, especially file based one's like Access, etc...,you have to worry about connectivity, speed, syntax, LOCATION. What if some ID 10 T decides he wants to delete/move some files and ends up deleting a crucial file. What are the odds that same ID 10 T is going to find an entry in the registry, much less have a reason for deleting it?

    If we're talking really complex data, then yes, it probably should be in some sort of supporting file, but if we're talking simple data, then the eregistry is the way to go.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Springfield
    Posts
    120
    Thanks, so you mean if we use SQL database, it can easily accomplish same. The only advantage to use registry is simple.
    Am I correct?
    MM

  4. #4
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    I'm sure that you will get more in depth and technical answers to why you should write to registry.
    But on a practical level, an example would be:

    When you write a program that requires a File Open dialog box, it is handy sometimes to have the default folder to be the last folder browsed, regardless wether the program has been shut down or not (something VB6 doesn't do itself, funily enough!). Writing this directory string to the registry means you can hold it there until your program is rerun and the FileOpen dialog box opened again.

    Now, as it is only one string, it is not worth creating a database. You could use a text file. or ini file, but why have an extra file?

  5. #5
    DaoK
    Guest
    Registery is great because most of common user do not go check in registery so you can put some variable value there to save them. Of course, it's not a good place to put big text.

  6. #6
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Originally posted by Mark_Meng
    Thanks, so you mean if we use SQL database, it can easily accomplish same. The only advantage to use registry is simple.
    Am I correct?
    Well, yes is the answer. You may also be working in an environment where administers don't like developers messing with the registry, so SQLServer would do (but would be theoretically slower)

  7. #7
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    The registry should be used for configuration data, or simple data you just need to grab or save. Use a (relational) database for structured, organized data you wish to sort or search. Use XML files for something in between.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  8. #8
    jim mcnamara
    Guest
    Gaffer is quite correct about the simple aspect, but some other main reasons for the using the registry:

    You can store bits of information on a per-user basis You dont need to keep track of the user

    It's fairly idiotproof

    And as Gaffer mentioned, you can use SaveSetting & GetSetting in VB to this kind of thing. You don't necessarily have to use the Registry api calls, unless you need to get fancy.

    It's fast, and doesn't require any external files, networks, servers.

    It's hidden from most users

    Disadvantage - it doesn't follow a user from machine to machine if he changes PC's during the day, and you're doing stuff on a per-user basis

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Location
    Springfield
    Posts
    120
    I think I got it. Thanks very much, I really appreciate
    MM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width