Hi, I'm wondering about something here. How would you detect if a user has a key value in the registry, and if it's not there, create one? The code (at end of post) a friend of mine and me are using doesn't do this. What it does is crash if the m_hKey is NULL.
(PS: Thanks in advance for any help)Code:m_regApp.Create(HKEY_CURRENT_USER, "Software\\TriFaze\\Jam MP3\\"); if(m_regApp.m_hKey == NULL){ TRACE("Unable to set m_hKey!\n"); } else{ TRACE("m_hKey set!\n"); } // Write the new registry settings m_regApp.Open(HKEY_CURRENT_USER, "Software\\TriFaze\\Jam MP3\\"); // Get last saved directory m_regApp.SetValue(myMusic, "LastDir"); // Set new directory m_regApp.SetValue("255", "LastVolume"); // Set new volume level if(!m_regApp.QueryValue(drive, "SelectDrive", (DWORD*)&m_dwRead)){ if(ccd.DoModal() == ID_OK){ m_regApp.QueryValue(drive, "SelectDrive", (DWORD*)&m_dwRead); } } m_regApp.Close(); // Close the key



LinkBack URL
About LinkBacks



