11-18-2008 09:02 PM
Hi Everyone,
I'm looking for recommendations as to where (and how) to best store program configuration data for a LV executable running under Vista. I need to store a number of things like window location, values of controls, etc. Under XP I just stored it right in the VIs own execution path. But under Vista, certain directories (such as C:\Program Files) are now restricted without administrator rights, so if my program is running from there, I dont think it'll be able to write its config file.
Also right now I'm just using the Write to Spreadsheet File block to store my variables. Does this sound alright or are these better suggestions?
Thanks!
Solved! Go to Solution.
11-20-2008 11:15 AM
Hi Yohan,
Are you saying that in Vista you can't save your default values? LabVIEW defaults are handled automatically and we do not recommend that you change any settings outside of the LabVIEW environment. To save defaults in the LabVIEW environment, click Edit»Make Current Values Default.
Does that answer your question? If not, please explain exactly what you're doing to enlist the help of others in this community.
Regarding your other question, I recommend creating a new discussion forum thread. You'll be much more likely to get others from the community involved.
Thanks,
11-20-2008 11:34 AM
For config data I use the Configuration VIs or the OpenG Configuration VIs. The format proved to be flexible during developement (adding new values is backward compatible).
xml would be nice, but the current implementation is unflexible when you add/change the data structure (the old config file can't be reused).
If the amount of data is few (just a windows position and size or some file path`s), the windows registry is an alternative (giving a unique set for each user if desired).
I have no experience with Vista.
Felix
11-20-2008 11:44 AM
Dan_R wrote:Hi Yohan,
Are you saying that in Vista you can't save your default values? LabVIEW defaults are handled automatically and we do not recommend that you change any settings outside of the LabVIEW environment. To save defaults in the LabVIEW environment, click Edit»Make Current Values Default.
Does that answer your question? If not, please explain exactly what you're doing to enlist the help of others in this community.
Regarding your other question, I recommend creating a new discussion forum thread. You'll be much more likely to get others from the community involved.
Thanks,
HI Dan,
What I think Yohan is asking about is that in VISTA security is implemented by the OS such that the folders with executables can not be written too. SO the tried an ture method writting to a sub-folder of the application is not allowed.
Ben
11-20-2008 01:32 PM
Re: Dan
Thanks for your reply! I think we may be talking about different things. I can certainly save default values of VIs in vista, but I'm concerned about saving control values in a LabVIEW executable. As I understand it, programmatically setting default values is not supported when VIs are compiled.
Re: Felix
Thanks, I'll try the Configuration File VIs. Looks like they create much neater files.
-Yohan
11-21-2008 06:46 PM
Thanks Yohan,
I think I got it now. So the problem is that you can save your default values in development, but when you run an executable, those values aren't saved? Can anybody else with a Vista OS reproduce this? As a workaround, you could try creating a local variable and writing a constant to the control's value at the start of your program. Would that work?
It will take me some time to get a computer with Vista, write, compile & run an executable. Hopefully I can get some evidence and document this behavior if it is a bug. So far I couldn't find anybody else who is reporting this problem. I'll search more in depth, too.
Regards,
11-21-2008 09:45 PM
Dan_R wrote:Thanks Yohan,
As a workaround, you could try creating a local variable and writing a constant to the control's value at the start of your program. Would that work?
I think you are still missing what he is talking about. Not about how to set control values in the program, but how to write out and read in a configuration data file within the VISTA OS. Since the program directory where the executable is installed to in VISTA is now off limits as a location to store his configuration data file.
11-22-2008 07:20 AM
I fopund some stuff on microsoft page. Here the link and a short past from taht document:
Application settings that need to be changed at run time should be stored in one of the following locations:
CSIDL_APPDATA
CSIDL_LOCAL_APPDATA
CSIDL_COMMON_APPDATA
Documents saved by the user should be stored in the CSIDL_MYDOCUMENTS folder.
Can't tell you more as I have no Vista around to look for the CSILD stuff.
Felix
11-23-2008 10:56 AM
Re: Dan,
Well actually I don't think LabVIEW is even supposed to allow programmatic "save values as default" with executables. It would be nice, but I can understand how that might be a hassle since you'd essentially be asking the EXE to re-write itself. In looking at references for how to do this (e.g. http://www.originalcode.com/SavDef.htm), it seems clear that LabVIEW executables won't save default values on their own: "It should also be noted that this technique will not work in built executables, since the LabVIEW environment for executables does not support the edit mode."
Therefore, I'm trying to write my own config files when the VI closes. The configuration file VIs have worked wonderful for me. I've tested it under Vista using the %APPDATA% path (C:\ProgramData\) and it works great. No rights issues. This page also helped out a lot: http://zone.ni.com/devzone/cda/tut/p/id/7005 I just wish the future block it discusses was available now!
Thanks eveyone!
-Yohan