BOOL CSpinDoctorApp::InitInstance() { // Enable 3D Controls #ifdef _AFXDLL Enable3dControls(); #else Enable3dControlsStatic(); #endif CRegistry oReg; int iPrecision, iAngleType, iOnTop, iSelectedTab; // Load registry settings oReg.OpenKey(CURRENT_USER, "Software\\vapourtech\\SpinDoctor", true); iPrecision = oReg.ReadInt("Precision", 2); iAngleType = oReg.ReadInt("AngleType", 0); iOnTop = oReg.ReadInt("OnTop", 0); iSelectedTab = oReg.ReadInt("SelectedTab", 0); oReg.CloseKey(); // Create dialog CSpinDoctorDlg dlg; m_pMainWnd = &dlg; // Set information in main dialog dlg.SetOptions(iPrecision,iAngleType,iOnTop,iSelectedTab); // Display dialog dlg.DoModal(); // Retrieve settings from dialog dlg.GetOptions(&iPrecision,&iAngleType,&iOnTop,&iSelectedTab); // Save registry settings if (oReg.OpenKey(CURRENT_USER, "Software\\vapourtech\\SpinDoctor", false)) { oReg.WriteInt("Precision", iPrecision); oReg.WriteInt("AngleType", iAngleType); oReg.WriteInt("OnTop", iOnTop); oReg.WriteInt("SelectedTab",iSelectedTab); oReg.CloseKey(); } else { ::AfxMessageBox("Could not save registry settings!",MB_ICONERROR|MB_OK); } // Finised, so return false return FALSE; }
void CHostBaseDownloadDlg::GetValue() { m_nBaudrateIdx = ((CComboBox*)GetDlgItem(IDC_BAUDRATE_IDX))->GetCurSel(); GetDlgItem(IDC_IMG_PATH)->GetWindowText(m_strPath); m_nBufferIdx = ((CComboBox*)GetDlgItem(IDC_BUFFER_IDX))->GetCurSel(); CRegistry reg; reg.SetRootKey(HKEY_CURRENT_USER); if(reg.SetKey(VIEWER_REG_PATH, false)) { reg.WriteInt("hb_baudrate", m_nBaudrateIdx); reg.WriteString("hb_firmware", m_strPath); reg.WriteInt("hb_buffer", m_nBufferIdx); } }
void CParallelDownloadDlg::OnOK() { //m_nBaudrateIdx = ((CComboBox*)GetDlgItem(IDC_BAUDRATE_IDX))->GetCurSel(); m_nFlashType = ((CComboBox*)GetDlgItem(IDC_FLASH_TYPE))->GetCurSel(); GetDlgItem(IDC_IMG_PATH)->GetWindowText(m_strPath); // m_isInternal = ((CButton*)GetDlgItem(IDC_IN_LOADER))->GetCheck(); // m_nBufferIdx = ((CComboBox*)GetDlgItem(IDC_BUFFER_IDX))->GetCurSel(); CRegistry reg; reg.SetRootKey(HKEY_CURRENT_USER); if(reg.SetKey(VIEWER_REG_PATH, false)) { //reg.WriteInt("pl_baudrate", m_nBaudrateIdx); reg.WriteInt("pl_flashtype", m_nFlashType); reg.WriteString("pl_firmware", m_strPath); //reg.WriteInt("pl_internal", m_isInternal); //reg.WriteInt("pl_buffer", m_nBufferIdx); } CDialog::OnOK(); }