rmain.h
来自「《Visual C++串口通信技术与典型实例》中所举例子的源代码」· C头文件 代码 · 共 76 行
H
76 行
#include <afxwin.h>
/////////////////////////////////////////////////////////////////////////////
// CRMain
class CRMain
{
public:
CRMain();
~CRMain();
// Attributes
public:
operator HKEY() const;
HKEY m_nMain;
// Operations
public:
LONG SetValue(DWORD dwValue, LPCTSTR lpszValueName);
LONG QueryValue(DWORD& dwValue, LPCTSTR lpszValueName);
LONG QueryValue(LPTSTR szValue, LPCTSTR lpszValueName, DWORD* pdwCount);
LONG SetValue(LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
LONG SetKeyValue(LPCTSTR lpszKeyName, LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
static LONG WINAPI SetValue(HKEY hKeyParent, LPCTSTR lpszKeyName,
LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName,
LPTSTR lpszClass = REG_NONE, DWORD dwOptions = REG_OPTION_NON_VOLATILE,
REGSAM samDesired = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES lpSecAttr = NULL,
LPDWORD lpdwDisposition = NULL);
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName,
REGSAM samDesired = KEY_ALL_ACCESS);
LONG Close();
HKEY Detach();
void Attach(HKEY hKey);
LONG DeleteSubKey(LPCTSTR lpszSubKey);
LONG RecurseDeleteKey(LPCTSTR lpszKey);
LONG DeleteValue(LPCTSTR lpszValue);
};
inline CRMain::CRMain()
{m_nMain = NULL;}
inline CRMain::~CRMain()
{Close();}
inline CRMain::operator HKEY() const
{return m_nMain;}
inline HKEY CRMain::Detach()
{
HKEY hKey = m_nMain;
m_nMain = NULL;
return hKey;
}
inline void CRMain::Attach(HKEY hKey)
{
_ASSERTE(m_nMain == NULL);
m_nMain = hKey;
}
inline LONG CRMain::DeleteSubKey(LPCTSTR lpszSubKey)
{
_ASSERTE(m_nMain != NULL);
return RegDeleteKey(m_nMain, lpszSubKey);
}
inline LONG CRMain::DeleteValue(LPCTSTR lpszValue)
{
_ASSERTE(m_nMain != NULL);
return RegDeleteValue(m_nMain, (LPTSTR)lpszValue);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?