예제 #1
0
파일: SSD.cpp 프로젝트: zphseu/cuiyan
BOOL CSSD::SaveToReg(CString RegPath)
{
	CRegistry Reg;
	
	if (RegPath.IsEmpty())
		RegPath = GetRegPath();

	if (m_ssd.m_szName.IsEmpty() || m_ssd.m_szEmail.IsEmpty() 
		|| m_ssd.m_szSerial.IsEmpty())
		return FALSE;

	if (!Reg.VerifyKey(HKEY_LOCAL_MACHINE, RegPath) &&
		!Reg.CreateKey(HKEY_LOCAL_MACHINE, RegPath) )
			return FALSE;
	
	if (!Reg.Open(HKEY_LOCAL_MACHINE, RegPath))
		return FALSE;

	if (!Reg.WriteString(_T("Name"), m_ssd.m_szName) ||
		!Reg.WriteString(_T("Email"), m_ssd.m_szEmail) ||
		!Reg.WriteString(_T("SSD"), m_ssd.m_szSerial) )
		return FALSE;
	
	Reg.Close();

	return TRUE;
}
예제 #2
0
///////////////////////////////////////////////////////
// CSoundRegistry::SoundEvent
//
//
void CSoundRegistry::SoundEvent(LPCSTR szEvent, LPCSTR szEventName, LPCSTR szPath)
{
	CRegistry sound;
	CString sEvent("AppEvents\\EventLabels\\");

	sEvent += szEvent;

	sound.CreateKey(sEvent, HKEY_CURRENT_USER);
	sound.SetString(NULL, szEventName);

	sEvent  = "AppEvents\\Schemes\\Apps\\";
	sEvent  += m_sScheme;

	if (!m_bSetScheme)
	{
		m_bSetScheme = TRUE;
		sound.CreateKey(sEvent, HKEY_CURRENT_USER);
		sound.SetString(NULL, m_sSchemeName);
	}

	sEvent += '\\';
	sEvent += szEvent;

	// If the key doesn't exist
	if (!sound.OpenKey(sEvent, HKEY_CURRENT_USER))
	{
		// Create the key with the right name
		sound.CreateKey(sEvent, HKEY_CURRENT_USER);
		sound.SetString(NULL, szEventName);

		// Set the default sound
		sEvent += "\\.current";
		sound.CreateKey(sEvent, HKEY_CURRENT_USER);
		sEvent  = szPath;
		sEvent += szEventName;
		sEvent += ".wav";
		sound.SetString(NULL, sEvent);
	}
}