Read and write registry with VC

xiaoxiao2021-03-06  19

Most of us have their own setup information, we can write them in an ini file, and the program is put together, but this will increase the files of the program directory, in the Windows platform, the best solution is Write them into the registry.

To write an entry into the registry, just need to use the following statement:

AfxGetApp () -> WriteProfileString (Key, Value, Data);

KEY, VALUE, DATA are both CString types. Key is the item name, value is a value name, containing data in the item, DATA is the value corresponding to the value. They all automatically allocated in the program name corresponding to the program name, do not use you to operate.

When you read them, you only need to use the following statement:

CSTRING DATA = AFXGETAPP () -> getProfileString (Key, Value);

The meaning of Key, Value, and Data.

转载请注明原文地址:https://www.9cbs.com/read-46909.html

New Post(0)