void MainWindow::saveOptions() { RegistryKey *r; RegistryKey::Value *v; r = new RegistryKey(_T("HKEY_CURRENT_USER\\Software\\Light Focus")); v = r->loadValue(_T("SavePath")); v->setString(_savePath); delete v; v = r->loadValue(_T("HookPrintScreen")); if (_isHookPrintScreen) { v->setDword(1); } else { v->setDword(0); } delete v; v = r->loadValue(_T("IncludeBackground")); if (_isIncludeBackground) { v->setDword(1); } else { v->setDword(0); } delete v; v = r->loadValue(_T("Delay")); v->setDword(_delay); delete v; v = r->loadValue(_T("SaveType")); v->setDword(_saveType); delete v; v = r->loadValue(_T("CaptureMode")); v->setDword(_captureMode); delete v; delete r; }
void MainWindow::loadOptions() { RegistryKey *r; RegistryKey::Value *v; try { r = new RegistryKey(_T("HKEY_CURRENT_USER\\Software\\Light Focus")); } catch (Exception &e) { r = registerOptions(); } v = r->loadValue(_T("SavePath")); _savePath = v->getString(); delete v; v = r->loadValue(_T("HookPrintScreen")); if (v->getDword() == 1) { setHook(_handle); _isHookPrintScreen = true; } else { _isHookPrintScreen = false; } delete v; v = r->loadValue(_T("IncludeBackground")); if (v->getDword() == 1) { _isIncludeBackground = true; } else { _isIncludeBackground = false; } delete v; v = r->loadValue(_T("Delay")); _delay = v->getDword(); delete v; v = r->loadValue(_T("SaveType")); _saveType = v->getDword(); delete v; v = r->loadValue(_T("CaptureMode")); _captureMode = v->getDword(); delete v; delete r; }