0

I wanted someone to help me decide which is the best option to save the settings of an application on vb6. I understand that this can be done with an INI file and/or modifying the registry. I need you to move the directory if one computer to another, the application stops working. What you think is the best option?

If someone has an interesting link that can help me thank you very much!

Thank you for readme and sorry for my English!

Emily
  • 314
  • 2
  • 17
  • I would go with an option file. An INI file is fine and *VB* supports them out of the box. The registry is useful only if you want to share those setting with other applications. – Margaret Bloom Feb 27 '16 at 14:09
  • If you want to be able to move the app and its settings to another machine, definitely use the INI file. You will, however, run into problems if you try to write to an INI file in the application's directory if the application is stored in the Program Files folder (or some other directory that a standard user doesn't have write privileges to). In that case, you'll need to store the INI file in the AppData folder. – Cody Gray - on strike Feb 27 '16 at 14:21
  • 1
    Related: http://stackoverflow.com/questions/6607/registry-vs-ini-file-for-storing-user-configurable-application-settings – Cody Gray - on strike Feb 27 '16 at 14:24
  • There is no support for INI files "in the box" in VB. Instead you have to roll your own code or rely on the risky API calls which can have unexpected side-effects such as creating registry entries. Since that's the case INI format offers few advantages so you may as well use XML, JSON, PropertyBag, or an ad-hoc format of your own such as VB's `Write #`/`Input #` statements' format. – Bob77 Feb 28 '16 at 18:23
  • There's no INI support out of the box in VB6, but Karl Peterson's [drop-in INI class](http://vb.mvps.org/samples/kpIni/) is good and easy to use. – MarkJ Mar 02 '16 at 06:43
  • [This question](http://stackoverflow.com/questions/547730/modern-day-unicode-friendly-ini-file-to-store-config-data-in-vb6) Is about whether to use IN I or XML for configuration files in vb6. – MarkJ Mar 02 '16 at 06:45

1 Answers1

0

We don't use the registry but follow these steps which has worked well for us even when crossing platforms and new versions of a language:

  1. Save all parameters in a table in a database associated with the application. We normally call this "Code" with the fields "Type", "Code", "Description", and "Control". For example, the name of the company would be stored in the table as "PARM","CONAME","My Company Name","". If you have a dynamic list of transaction types, store them as "TRNS","01","My 1st Type","" and "TRNS", "02", "My 2nd Type", "" and so forth. The Control field is used for anything you want that's hidden from the user but possibly controls how the program responds based upon the users selection of that type...as an example. To get the list of types, just use a SELECT statement like "SELECT * FROM [Code] WHERE [Type]='TRNS' ORDER BY [Code];".

  2. Save the connection to the database in an encrypted ini file. We wrote the encryption and decryption functions ourselves. There are various out of the box ways to do this on various blogs.

Installing the application on another system demands access to the database and copying the ini file.

Jim
  • 1