全部博文(584)
分类: C/C++
2011-04-11 12:12:35
需要#include
只举几个简单的例子:
1、用QSettings写注册表
view
plaincopy to clipboardprint?
1. QSettings *reg = new
QSettings("HKEY_CURRENT_USER\\Software\\yinhaifan",
2.
QSettings::NativeFormat);
3. reg->setValue("registered",true);
4.
delete
reg;
当然reg->setValue还可以写入字符串,整型之类的数据。
比如reg->setValue("registered","yes");
2、用QString读注册表
view
plaincopy to clipboardprint?
1. QSettings *reg = new
QSettings("HKEY_CURRENT_USER\\Software\\yinhaifan",
2.
QSettings::NativeFormat);
3. if
(reg->value("registered",false).toBool())
4. {
5.
QMessageBox::information(NULL,"information","registered");
6. }
7. delete
reg;
还可以toInt(),toString()等。