/// 根键值
HKEY m_base;
m_base = HKEY_CURRENT_USER;
/// 注册表位置
wxString m_path;
m_path = wxT("Software\\ThpClient\\DirPath\\CalcDllPath");
/// 注册表键值位置
std::string m_key;
m_key = "myselfValue";
/// 需要修改的键值
std::string m_value = "http://www.baidu.com";
/// 键值句柄,存储
HKEY m_hKey;
/// 错误代号
LONG LastError;
/// 打开注册表的类型
DWORD disp= REG_OPENED_EXISTING_KEY;
/// 创建注册表句柄
RegCreateKeyEx(m_base, m_path, 0, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_hKey, &disp))!=ERROR_SUCCESS)
/// 写入键值
RegSetValueExA(m_hKey, m_key.c_str(), 0, REG_SZ, (const BYTE*)m_value.c_str(),m_value.size())==ERROR_SUCCESS)
char m_readvalue[512] = {0};
DWORD m_typeword;
DWORD m_valuelength;
RegQueryValueExA(m_hKey, m_key.c_str(), 0, &m_typeword, (LPBYTE)m_readvalue,&m_valuelength);
LastError = RegCloseKey(m_hKey);