#include "dialog.h"#include "ui_dialog.h"#include <qt_windows.h>#include <qDebug>Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog){ ui->setupUi(this);}Dialog::~Dialog(){ delete ui;}void Dialog::on_pushButton_clicked(){ DWORD dwFilter = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY; HANDLE hEvent; HKEY hMainKey; HKEY hKey; LONG lErrorCode; hMainKey=HKEY_LOCAL_MACHINE; lErrorCode = RegOpenKeyEx(hMainKey, (LPCWSTR)"", 0, KEY_NOTIFY, &hKey); if (lErrorCode != ERROR_SUCCESS) { qDebug()<<"Error in RegOpenKeyEx "<< lErrorCode; return; }
QTextCodec codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForTr(codec);
lErrorCode = RegOpenKeyExA(hMainKey, "SOFTWARE", 0, KEY_NOTIFY, &hKey); lErrorCode = RegOpenKeyExW(hMainKey, L"SOFTWARE", 0, KEY_NOTIFY, &hKey);
lErrorCode = RegOpenKeyEx(hMainKey, L"SOFTWARE", 0, KEY_NOTIFY, &hKey);