积极答复者
关于如何保存和设置用户配置的问题

问题
-
亲各位大虾帮个忙,
小弟正在用vs2005.net C++做一个winform的程序,需要保存用户输入的设置信息,比如哪个个checkbox被选中了,textbox里输入了什么信息之类的。当用户完成输入后,再按一个“save”键就能把这些信息保存到某个文件中,然后下次开机启动时,程序就能读取这些信息,然后自动按照用户的设置运行。如果用户想要更改也能再次写入新的设置信息。
我在网上查了下,发现VB中有My.Settings, c#中有Properties.Settings有相关的功能,但是不知道vc++中有没有相关的功能呀?如果有的话,能不能给些如何使用的例子。
另外我自己想到一个比较笨的办法,就是新建一个.txt文件,然后把用户的设置全部写进去,再启动时,程序逐行读取设置信息,按照信息配置。但是用.txt文件的话,好像不大安全。
答案
-
可以保存到文件或者注册表中均可。
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Elegentin XieModerator 2012年10月26日 5:07
-
-
使用ini文件即可
对应的API函数是
GetPrivateProfileInt,GetPrivateProfileString
WritePrivateProfileString
这一系列函数
- 已标记为答案 Elegentin XieModerator 2012年10月26日 5:07
全部回复
-
可以保存到文件或者注册表中均可。
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Elegentin XieModerator 2012年10月26日 5:07
-
-
使用ini文件即可
对应的API函数是
GetPrivateProfileInt,GetPrivateProfileString
WritePrivateProfileString
这一系列函数
- 已标记为答案 Elegentin XieModerator 2012年10月26日 5:07