registry.h
来自「一个快捷面板,可以将自己常用的程序放在其中!」· C头文件 代码 · 共 71 行
H
71 行
#if !defined(AFX_REGISTRY_H__E0610A5D_7166_4D02_9D7E_11AF7CF8E229__INCLUDED_)
#define AFX_REGISTRY_H__E0610A5D_7166_4D02_9D7E_11AF7CF8E229__INCLUDED_
//
#include <winreg.h>
/////////////////////////////////////////////////////////////////////////////
// CRegistry window
class CRegistry : public CObject
{
// Construction
public:
CRegistry(HKEY hKey = HKEY_LOCAL_MACHINE);
virtual ~CRegistry();
public:
// 创建指定键
BOOL CreateKey(LPCTSTR lpSubKey);
// 打开指定键
BOOL Open(LPCTSTR lpSubKey);
// 打开系统键
void SetKey(HKEY hKey) { ASSERT(hKey); m_hKey = hKey; };
// 读指定键值内容
BOOL Read(LPCTSTR lpValueName, CString* lpVal);
BOOL Read(LPCTSTR lpValueName, DWORD* pdwVal);
BOOL Read(LPCTSTR lpValueName, int* pnVal);
BOOL Read(LPCTSTR lpValueName, BYTE *lpData, DWORD cbData);
// 读取结构
BOOL Read(LPCTSTR lpValueName, CFont *pFont);
BOOL Read(LPCTSTR lpValueName, CPoint *pPoint);
BOOL Read(LPCTSTR lpValueName, CSize *pSize);
BOOL Read(LPCTSTR lpValueName, CRect *pRect);
// 写入指定键值
BOOL Write(LPCTSTR lpSubKey, LPCTSTR lpVal);
BOOL Write(LPCTSTR lpSubKey, DWORD dwVal);
BOOL Write(LPCTSTR lpSubKey, int nVal);
BOOL Write(LPCTSTR lpSubKey, const BYTE* lpDate, DWORD cdData);
// 写结构
BOOL WriteFont(LPCTSTR lpValueName, CFont *pFont);
BOOL WritePoint(LPCTSTR lpValueName, CPoint *pPoint);
BOOL WriteSize(LPCTSTR lpValueName, CSize *pSize);
BOOL WriteRect(LPCTSTR lpValueName, CRect *pRect);
// 删除指定键
BOOL DeleteKey(HKEY hKey, LPCTSTR lpSubKey);
// 从指定键删除指定的值
BOOL DeleteValue(LPCTSTR lpValueName);
//将指定键、子键及值存入文件
BOOL SaveKey(LPCTSTR lpFileName);
//从指定文件读取注册表信息
BOOL RestoreKey(LPCTSTR lpFileName);
// 闭关键
BOOL Close();
protected:
HKEY m_hKey;
};
/////////////////////////////////////////////////////////////////////////////
#endif // !defined(AFX_REGISTRY_H__E0610A5D_7166_4D02_9D7E_11AF7CF8E229__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?