Hi Folks,

First off, let me say that I can fully appreciate Arnor's frustration about
Vista. I've said some VERY bad things about it and the weanies at
Microsoft this past week!

;-)

I've been dealing with the issue of "where's my data" for PageSnip and
having survived it (all is working well now - thanks to a lot of help from
Friedrich!) I wanted to pass on what I came up with.

First off, my installer runs with elevated permissions as you'd expect.

Data is installed (by default) under Program Files.

A program Registry key is created under HKLM and the path to where the app
is installed is stored there in a value called ProgramDir.


Now that is fine - I now know where the app is installed and this key is
available "read only" by any user at any level.


Next is the placement of the data.

FWIW - I don't have demo data, but if I did, I think that I would lean
towards installing it into a read only folder under the program dir (and
copying it to a user's profile when they start the app) or by putting it
into the COMMON data folder and grabbing a copy from there.


The way I solved my "where's the data" problem was to turn once again to
SetupBuilder.

I created a new script that is actually a "pre-loader" for PageSnip. This
app (which compiled down to a exe < 140K) actually gets installed into the
HKLM RUN Registry.

This way this tiny executable gets ran when any user logs in - no matter
what their level of access.

In the beginning the SB script reads the entry from HKLM to know where the
program is installed. Then it checks to see that the program.exe is
actually there. If it is not, then it gives a simple message about that
and exits the script.

If the program.exe is there, then it uses SB to get the user's LOGIN NAME.

Then it reads the PageSnip key from HKCU to see if it has a value called
DataDir. If it does not, then it runs a simple three step "PageSnip User
Wizard" to establish the data paths.


Now to keep it simple (thank you David<g>), the wizard asks a question:

Step 1 - Decide if you want to share your data

Then there is a drop box that defaults to:

"Keep my PageSnip data private"

The other drop entry says:

"Share my PageSnip data with other users on this computer"


There is also a brief message on the dialog box that tells them that based
on their selection, the wizard will suggest a data location for them.

They click Next to continue.


This Step 2 of the wizard lets them select a location for the data files.

By default (and using the CSIDL values relative to that LOGIN NAME) the
suggested locations are either like:

C:\Documents and Settings\Charles\My Documents\My PageSnips

or

C:\Documents and Settings\All Users\Documents\Shared PageSnips


(Note that the CSIDL for the LOGIN NAME is correct for that user)



So by default the user can just click Next and the data goes into a sub
folder of their My Documents.

If they want to change it - they can put it anywhere EXCEPT under Program
Files. If they try that - the wizard refuses to accept it (after all -
with Vista there is no point in allowing them to shoot themselves in the
foot<g>). Also the wizard makes sure that there is a value.

Next I have one other dialog box where I allow them to enter a piece of
optional information.


Next I then show them a custom ready to install dialog that shows where the
data is going and (in my case) the Windows login name and the name of their
PageSnip profile.

When they click Next I create my folders (using CSIDL values) and write my
HKCU entries for that user.


Then I launch PageSnip and it reads the HKCU values, knows where the data
goes ... and life is good.



Now - the user reboots and logs in again at some later time.


The same small "preloader" exe runs from HKLM.

It checks the HKCU of the user, gets the DataDir value (and the ProgramDir
too).

It also checks a entry in the HKCU key to see if it should Run PageSnip on
startup (note that this is enabled by default and the user would have to
turn it off in the app).

If it is supposed to run the program, it does - then the script exist
without displaying the wizard.


Again since this is a less than 140K exe in the startup and it does not
stay in memory - no harm, no foul.


As an aside, I also added some command line flags that allow me to call the
small exe from within the app to reset the data locations. This means I
don't have to write extra screens in the app for this and the "PageSnip
User Wizard" is exactly the same as the user remembered it the first time.


Note that I could have just as easily completed my wizard by copying sample
data to the correct folder (based on the user selection).


Having the small exe that runs as a preloader with the login means that my
app is never "lost". Even when a new user login is added to the machine,
the "PageSnip User Wizard" would automatically run to complete the setup
for that user.


This may not be the perfect solution, but I can tell you that I put a LOT
of thought and work into **HOW** to solve these problems and this is what I
came up with.


Friedrich is right in that we have to stop thinking about pre-Vista and
just set our sights on providing installs and initializations that work
under Vista.

Meanwhile - I hope that this gives some of you ideas on how to deal with
this under Vista.

IMHO - it is more than just putting the data in the Common Documents CSIDL
- you have to consider and use the HKCU Registry as it was planned to be
used.


To everyone here:

"Good luck on your Vista projects!"


To Microsoft:

"Pull my finger!"


;-)

Charles





--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------