BOOL CHostBaseDownloadDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* baudrateCombo = (CComboBox*)GetDlgItem(IDC_BAUDRATE_IDX); CComboBox* bufferCombo = (CComboBox*)GetDlgItem(IDC_BUFFER_IDX); g_setting.InitBaudrateCombo(baudrateCombo); baudrateCombo->AddString("SPI"); CRegistry reg; reg.SetRootKey(HKEY_CURRENT_USER); if(reg.SetKey(VIEWER_REG_PATH, TRUE)) { m_nBaudrateIdx = reg.ReadInt("hb_baudrate", g_setting.boostBaudIndex); m_strPath = reg.ReadString("hb_firmware", ""); m_nBufferIdx = reg.ReadInt("hb_buffer", 0); } else { m_nBaudrateIdx = BAUDRATE_DEFAULT; } if(m_strPath.IsEmpty()) { m_strPath = theApp.GetCurrrentDir(); m_strPath += "\\host.bin"; } baudrateCombo->SetCurSel(m_nBaudrateIdx); GetDlgItem(IDC_IMG_PATH)->SetWindowText(m_strPath); bufferCombo->SetCurSel(m_nBufferIdx); return TRUE; // return TRUE unless you set the focus to a control }
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; }
BOOL CHostBaseDownloadDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* baudrateCombo = (CComboBox*)GetDlgItem(IDC_BAUDRATE_IDX); CComboBox* bufferCombo = (CComboBox*)GetDlgItem(IDC_BUFFER_IDX); if(_V8_SUPPORT) { baudrateCombo->ResetContent(); for(int i=0; i<9; ++i) { CString strIdx; strIdx.Format("%d", CSerial::BaudrateTable[i]); baudrateCombo->AddString(strIdx); } } baudrateCombo->AddString("SPI"); CRegistry reg; reg.SetRootKey(HKEY_CURRENT_USER); if(reg.SetKey("Software\\GNSSViewer\\GPS", true)) { m_nBaudrateIdx = reg.ReadInt("hb_baudrate", g_setting.boostBaudIndex); m_strPath = reg.ReadString("hb_firmware", ""); m_nBufferIdx = reg.ReadInt("hb_buffer", 0); } else { m_nBaudrateIdx = BAUDRATE_DEFAULT; } if(m_strPath.IsEmpty()) { m_strPath = theApp.GetCurrrentDir(); m_strPath += "\\host.bin"; } baudrateCombo->SetCurSel(m_nBaudrateIdx); GetDlgItem(IDC_IMG_PATH)->SetWindowText(m_strPath); bufferCombo->SetCurSel(m_nBufferIdx); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX 屬性頁應傳回 FALSE }
// CParallelDownloadDlg BOOL CParallelDownloadDlg::OnInitDialog() { CDialog::OnInitDialog(); //CComboBox* baudrateCombo = (CComboBox*)GetDlgItem(IDC_BAUDRATE_IDX); CComboBox* flashTypeCombo = (CComboBox*)GetDlgItem(IDC_FLASH_TYPE); CComboBox* bufferCombo = (CComboBox*)GetDlgItem(IDC_BUFFER_IDX); CRegistry reg; reg.SetRootKey(HKEY_CURRENT_USER); if(reg.SetKey(VIEWER_REG_PATH, true)) { //m_nBaudrateIdx = reg.ReadInt("pl_baudrate", setting->boostBaudIndex); //m_nBaudrateIdx = setting->boostBaudIndex; m_nFlashType = reg.ReadInt("pl_flashtype", 0); m_strPath = reg.ReadString("pl_firmware", ""); //m_nBufferIdx = reg.ReadInt("pl_buffer", 0); } else { m_nBaudrateIdx = g_setting.boostBaudIndex; m_nFlashType = 0; } if(m_strPath.IsEmpty()) { m_strPath = theApp.GetCurrrentDir(); m_strPath += "\\prom.bin"; } //baudrateCombo->SetCurSel(m_nBaudrateIdx); flashTypeCombo->SetCurSel(m_nFlashType); GetDlgItem(IDC_IMG_PATH)->SetWindowText(m_strPath); //((CButton*)GetDlgItem(IDC_IN_LOADER))->SetCheck(m_isInternal); //bufferCombo->SetCurSel(m_nBufferIdx); return TRUE; // return TRUE unless you set the focus to a control }