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 CCCFixDlg::OnOK() { // Open registry CRegistry oReg; // Fix the .cc assocation key oReg.OpenKey(CLASSES_ROOT, ".cc", false); oReg.WriteString("", "cppfile"); oReg.CloseKey(); // Fix the .hh assocation key oReg.OpenKey(CLASSES_ROOT, ".hh", false); oReg.WriteString("", "hppfile"); oReg.CloseKey(); // Find and open the devstudio root key char strVCPPRoot[256] = ""; const char* strVCPPRoots[] = { "Software\\Microsoft\\Developer", "Software\\Microsoft\\DevStudio\\5.0", "Software\\Microsoft\\DevStudio\\6.0", }; for (int k=0; k<3; k++) { if (oReg.OpenKey(CURRENT_USER, strVCPPRoots[k], true)) { // Loop through possible compilers const int iNumCompilers = 6; const char* strCompilerKeys[iNumCompilers] = { "\\Build System\\Components\\Platforms\\Win32 (ALPHA)\\Tools\\C/C++ Compiler for Alpha", "\\Build System\\Components\\Platforms\\Win32 (PowerPC)\\Tools\\C/C++ Compiler for PowerPC", "\\Build System\\Components\\Platforms\\Win32 (x86)\\Tools\\32-bit C/C++ Compiler for 80x86", "\\Build System\\Components\\Platforms\\Win32 (WCE x86em)\\Tools\\C++ Compiler for 80x86em (Emulation)", "\\Build System\\Components\\Platforms\\Win32 (WCE MIPS)\\Tools\\C/C++ Compiler Mips R4100", "\\Build System\\Components\\Platforms\\Win32 (WCE SH)\\Tools\\C/C++ Compiler for SH", }; for (int i=0; i<iNumCompilers; i++) { char strKey[256] = ""; strcpy(strKey,strVCPPRoots[k]); strcat(strKey,strCompilerKeys[i]); // Try to open each key if (oReg.OpenKey(CURRENT_USER, strKey, true)) { char strInputSpec[256] = ""; // See if .cc is already in the Input_Spec oReg.ReadString("Input_Spec","",strInputSpec); oReg.CloseKey(); if (strlen(strInputSpec)>0 && strstr(strInputSpec,"*.cc")==NULL) { // If not, put it on the end oReg.OpenKey(CURRENT_USER, strKey, false); strcat(strInputSpec,";*.cc"); oReg.WriteString("Input_Spec",strInputSpec); oReg.CloseKey(); } } } //Fix IDE highlighting char strTextEditorKey[256] = ""; strcpy(strTextEditorKey,strVCPPRoots[k]); strcat(strTextEditorKey,"\\Text Editor\\Tabs/Language Settings\\C/C++"); if (oReg.OpenKey(CURRENT_USER,strTextEditorKey,true)) { char strFileExtensions[256] = ""; oReg.ReadString("FileExtensions","",strFileExtensions); oReg.CloseKey(); if (strlen(strFileExtensions)>0 && strstr(strFileExtensions,"cc")==NULL ) { strcat(strFileExtensions,";cc"); } if (strlen(strFileExtensions)>0 && strstr(strFileExtensions,"hh")==NULL ) { strcat(strFileExtensions,";hh"); } oReg.OpenKey(CURRENT_USER,strTextEditorKey,false); oReg.WriteString("FileExtensions",strFileExtensions); oReg.CloseKey(); } oReg.CloseKey(); } } CDoneDialog donedlg; donedlg.DoModal(); CDialog::OnOK(); }