Saving user settings in Windows 7...

A

Adman

Ok, so I've written a screensaver. In the configuration settings of
the screensaver, some changes can be made. I use the Settings
construct to save the settings, and read them back when the
screensaver loads.

On Windows XP, everything is working fine.

When I tried this on Windows 7, the screensaver loads, but it doesn't
seem to find the saved settings.

I can confirm that the settings file is saved in the c:\users
\<username>\AppData\Local\<appname> directory... But at runtime, the
settings don't seem to be picked up.

Anyone else have this problem...? Any ideas? Is this a Windows7
thing? Or did I mess up somewhere?

I think I tried the Screensaver Starter Kit as well, and I don't think
that worked either.

Adam
 
A

Adman

Some more information...

My screensaver works well (the settings ARE read) when I test it
manually. It also reflects in the "preview" window in the screensaver
control panel. But when the screensaver is launched "naturally" (when
the idle time is hit), THEN it doesn't work...

So what's different about when the screensaver is launched via idle
timeout, rather than when I launch it manually, or test it in the
control panel?

Adman
 
M

Mr. Arnold

Adman said:
Some more information...

My screensaver works well (the settings ARE read) when I test it
manually. It also reflects in the "preview" window in the screensaver
control panel. But when the screensaver is launched "naturally" (when
the idle time is hit), THEN it doesn't work...

So what's different about when the screensaver is launched via idle
timeout, rather than when I launch it manually, or test it in the
control panel?

On Windows 7 are you? That's still in beta, and I am kind of getting use to
Vista. :)
 
P

Peter Morris

I would guess that when Windows runs its screen saver there is no "current
user", try writing out the expected path to a log and checking what it is.
Maybe you should use the ProgramData folder instead?
 
A

Adman

Well, I added some code to message out the current user of the
process, and both times (I tried two different methods), it reported
me as the user (as opposed to some system or service account).

So, I'm not sure what's going on...

Can anyone else try the stock Screensaver Starter Kit that comes with
VS2005 under Vista or Windows 2007 and verify that changing the
configuration (the file path to the background pictures, for example),
works?

Thanks for your responses so far. If worst comes to worse, I suppose
I can put the settings in the registry or a local config file or
something. I just wanted to try using the built in Settings stuff...

Adman
 
P

Pavel Minaev

Well, I added some code to message out the current user of the
process, and both times (I tried two different methods), it reported
me as the user (as opposed to some system or service account).

So, I'm not sure what's going on...

Try also displaying the values returned by Environment.GetFolderPath
for ApplicationData and LocalApplicationData. I wonder if it somehow
sandboxes the screensaver without switching the user account...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top