LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best Practice for Storing Program Config Data on Vista?

Solved!
Go to solution

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!

Ramirez Kleinigger Consulting, LLC
http://www.thinkrkc.com/
0 Kudos
Message 1 of 9
(3,804 Views)

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,

Dan Richards
Certified LabVIEW Developer
0 Kudos
Message 2 of 9
(3,774 Views)
Solution
Accepted by topic author YohanShminge

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 

0 Kudos
Message 3 of 9
(3,769 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 9
(3,767 Views)

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

Ramirez Kleinigger Consulting, LLC
http://www.thinkrkc.com/
0 Kudos
Message 5 of 9
(3,753 Views)

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,

 

 

Dan Richards
Certified LabVIEW Developer
0 Kudos
Message 6 of 9
(3,734 Views)

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.

0 Kudos
Message 7 of 9
(3,726 Views)

I fopund some stuff on microsoft page. Here the link and a short past from taht document:

http://www.microsoft.com/downloads/details.aspx?FamilyID=BA73B169-A648-49AF-BC5E-A2EEBB74C16B&displa...

 

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

0 Kudos
Message 8 of 9
(3,711 Views)

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

Ramirez Kleinigger Consulting, LLC
http://www.thinkrkc.com/
0 Kudos
Message 9 of 9
(3,686 Views)