www.pudn.com > TidyWin32-src.zip > Profile.cpp


#include "StdAfx.h" 
 
#include "Profile.h" 
 
const char* TIDYGUI_REG_KEY = "Software\\HTML Tidy\\TidyGUI\\1.0"; 
const char* SOURCE_FILE_REG_KEY = "Source file"; 
const char* CONFIG_FILE_REG_KEY = "Config file"; 
 
//------------------------------------------------------------------- 
string GetProfileString(const char* key) 
{ 
	CRegKey regKey; 
	char szValue[_MAX_PATH]; 
	DWORD dwCount = _MAX_PATH; 
	regKey.Create(HKEY_CURRENT_USER, TIDYGUI_REG_KEY); 
 
	long res = regKey.QueryValue(szValue, key, &dwCount); 
	if (res == ERROR_SUCCESS) 
		return szValue; 
	else return ""; 
} 
 
void WriteProfileString(const char* key, const char* val) 
{ 
	CRegKey regKey; 
	regKey.Create(HKEY_CURRENT_USER, TIDYGUI_REG_KEY); 
 
	long res = regKey.SetValue(val, key); 
}