As @David points out, you can use the registry, files, or, of course, a combination of them.
If you send files, they must be saved in the current user part of the file system. In fact, the fundamental principle is that one user should not affect any other system user, and Windows applies this (for example, you cannot save files in the Program Files directory when working without elevated privileges 1 ).
For example, my AlgoSim software can save its settings in
C:\Users\Andreas Rejbrand\AppData\Roaming\Rejbrand\AlgoSim\2.0
folder. This is a typical example. You get the first part of the catalog, i.e.
C:\Users\Andreas Rejbrand\AppData\Roaming
by requesting the operating system for the application data folder for each user. You can use the SHGetKnownFolderPath function to find this. Use the folder identifier FOLDERID_RoamingAppData . If you need to support older versions of Windows, you can use SHGetFolderPath and use the constant CSIDL_APPDATA .
The rest of the path usually follows a pattern
Manufacturer Name\Product Name\Product Version
What files to store? Well, the easiest way is to use old-fashioned INI files, but you can also use XML, text files in your own format, or even binary files of your own design.
The second approach is to use the registry instead of files. You probably already know how to do this. If not, you will learn which of the examples is easy. For example, I can save the settings for each user in
HKEY_CURRENT_USER\Software\Rejbrand\AlgoSim\2.0
1 In this case, the operating system is smart enough to “emulate” the “Program Files” folder for each user. Although the program thinks it reads and writes to the Program Files folder, it actually reads and writes to the folder in the current user part of the file system. Thus, old and poorly managed applications continue to work even in new versions of the Microsoft Windows operating system, and in addition, they begin to support settings for each user, which they should have done first. I really think this is a +1 major for Microsoft, as I could say before.