Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Best place to write path into registry

  1. #1

    Default Best place to write path into registry

    I have been writing the path to my program into
    Hkey Local Machine\software\garagepartner\localpath

    Now I am manifesting using SB7 and the program is manifested asinvoker
    Do I need to change where I am writing the Path?

    --

    Dan Scott
    C55 C6.3 C7.1 LEGACY
    www.garagepartner.com

    King of questions for Clarion Third Party

    Plan A is always more effective when the device you are working on
    understands that Plan B involves a larger hammer

  2. #2

    Default Re: Best place to write path into registry

    Dan,

    > I have been writing the path to my program into
    > Hkey Local Machine\software\garagepartner\localpath
    >
    > Now I am manifesting using SB7 and the program is manifested asinvoker
    > Do I need to change where I am writing the Path?

    I assume you do not write the path from your own app to the registry but you
    let SetupBuilder do it for you (in this case you don't need to change
    anything). If your app is "asInvoker" manifested then you can still read
    the HKLM registry key.

    Friedrich

  3. #3

    Default Re: Best place to write path into registry

    Friedrich

    Sometimes the user may change the program location AFTER the install.
    So when an update is installed, I need to know where the new folder
    location is.

    Dan

    --

    Dan Scott
    C55 C6.3 C7.1 LEGACY
    www.garagepartner.com

    King of questions for Clarion Third Party

    Plan A is always more effective when the device you are working on
    understands that Plan B involves a larger hammer

  4. #4

    Default Re: Best place to write path into registry

    Dan,

    > Sometimes the user may change the program location AFTER the install.
    > So when an update is installed, I need to know where the new folder
    > location is.

    No problem. Then you have to copy it to a per-user location from your
    application.

    If you have to install "per-user" data, install it to a common location and
    as a "first run" action of your main application, copy the data from the
    common location into a per-user location.

    In other words, do not change anything in the installer. You still write to
    HKEY_LOCAL_MACHINE. But as a "first run" action of your application, copy
    the default folder from HKEY_LOCAL_MACHINE to a per-user registry location
    and you are done.

    Please note that you can't and should not uninstall per-user data (that is
    by Windows design and expected).

    Friedrich

  5. #5

    Default Re: Best place to write path into registry

    As Friedrich said, if your app is manifested and not virtualized there's no
    problem *reading* from the "real" HKLM registry.

    And if your program may be used by more than one user logon on any machine
    (which would mean different HKEY Current User instances), then HKLM is the
    best consistent place to store that information.

    Because I know some users are tweakers and may move things around, what I
    often do is to have the installation program write the path and the current
    date to HKLM.

    I have the app write the current path and date to HKEY Current User each
    time it's run.

    Any time I need the information, I can read both locations and use whichever
    is newer.

    Jane

  6. #6

    Default Re: Best place to write path into registry

    Jane

    See my reply to Friedrich.
    Problem is if they decide to change the program location after the install.

    Dan

    --

    Dan Scott
    C55 C6.3 C7.1 LEGACY
    www.garagepartner.com

    King of questions for Clarion Third Party

    Plan A is always more effective when the device you are working on
    understands that Plan B involves a larger hammer

  7. #7

    Default Re: Best place to write path into registry

    Dan

    See my reply.

    That's what my solution addresses.

    jf

  8. #8

    Default Re: Best place to write path into registry

    Sorry Jane, misread.

    Anyway... HKEY Current : Does this open a key for each user, or does any
    current user write to one particular key?
    Reason I ask is that they may change users 10 times a day.

    --
    Dan Scott
    C55 - C6.3 Legacy
    Garage Partner Pro / Invoice Partner
    www.garagepartner.com
    Plan A is always more effective when the device you are working on
    understands that Plan B involves a larger hammer

  9. #9

    Default Re: Best place to write path into registry

    Each user BECOMES current user when he's logged on.

    If you're using the registry, you really only have two options.
    1. per-user, written to HKEY Current User. Each user will have his own
    separate copy of the information stored here.
    2. for everybody on the machine, written to HKEY Local Machine. Everybody
    can read from HKLM and will always see the same information. But to WRITE
    to it requires elevation.

    Jane Fleming

  10. #10

    Default Re: Best place to write path into registry

    Jane

    Still having a problem wrapping my head around this.
    If user 1 logs on and changes the location of my program to
    c:\myprogram and then logs off, when user 2 logs in, does he start with
    a blank slate in current User. If so, then I can't use current user as
    the next user
    will not know where the program is.
    I am thinking that I should only let Adminstrators change the program
    folder.

    Dan

    --

    Dan Scott
    C55 C6.3 C7.1 LEGACY
    www.garagepartner.com

    King of questions for Clarion Third Party

    Plan A is always more effective when the device you are working on
    understands that Plan B involves a larger hammer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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