📄 cnregistry.h
字号:
//---------------------------------------------------------------------------
#include <windows.h>
#ifndef CNRegistryH
#define CNRegistryH
#include "CNStringList.h"
struct TCNRegKeyInfo
{
DWORD NumSubKeys;
DWORD MaxSubKeyLen;
DWORD NumValues;
DWORD MaxValueLen;
DWORD MaxDataLen;
_FILETIME FileTime;
} ;
enum TCNRegDataType { rdUnknown, rdString, rdExpandString, rdInteger, rdBinary };
struct TCNRegDataInfo
{
TCNRegDataType RegData;
DWORD DataSize;
} ;
//---------------------------------------------------------------------------
class TCNRegistry{
private:
HKEY FCurrentKey;
HKEY FRootKey;
bool FLazyWrite;
bool FCloseRootKey;
TCNString FCurrentPath;
unsigned FAccess;
protected:
void __fastcall ChangeKey(HKEY Value, const TCNString Path);
HKEY __fastcall GetBaseKey(bool Relative);
DWORD __fastcall GetData(const TCNString Name, void * Buffer, DWORD BufSize, TCNRegDataType &RegData);
HKEY __fastcall GetKey(const TCNString Key);
void __fastcall PutData(const TCNString Name, void * Buffer, DWORD BufSize, TCNRegDataType RegData);
void __fastcall SetCurrentKey(HKEY Value);
public:
__fastcall TCNRegistry(void);
__fastcall ~TCNRegistry(void);
void __fastcall CloseKey(void);
bool __fastcall CreateKey(const TCNString Key);
bool __fastcall DeleteKey(const TCNString Key);
bool __fastcall DeleteValue(const TCNString Name);
bool __fastcall GetDataInfo(const TCNString ValueName, TCNRegDataInfo &Value);
DWORD __fastcall GetDataSize(const TCNString ValueName);
TCNRegDataType __fastcall GetDataType(const TCNString ValueName);
bool __fastcall GetKeyInfo(TCNRegKeyInfo &Value);
void __fastcall GetKeyNames(TCNStringList* Strings);
void __fastcall GetValueNames(TCNStringList* Strings);
bool __fastcall HasSubKeys(void);
bool __fastcall KeyExists(const TCNString Key);
bool __fastcall LoadKey(const TCNString Key, const TCNString FileName);
void __fastcall MoveKey(const TCNString OldName, const TCNString NewName, bool Delete);
bool __fastcall OpenKey(const TCNString Key, bool CanCreate);
bool __fastcall OpenKeyReadOnly(const TCNString Key);
DWORD __fastcall ReadBinaryData(const TCNString Name, void *Buffer, DWORD BufSize);
bool __fastcall ReadBool(const TCNString Name);
double __fastcall ReadFloat(const TCNString Name);
DWORD __fastcall ReadInteger(const TCNString Name);
TCNString __fastcall ReadString(const TCNString Name);
bool __fastcall RegistryConnect(const TCNString UNCName);
void __fastcall RenameValue(const TCNString OldName, const TCNString NewName);
bool __fastcall ReplaceKey(const TCNString Key, const TCNString FileName, const TCNString BackUpFileName);
bool __fastcall ValueExists(const TCNString Name);
void __fastcall WriteBinaryData(const TCNString Name, void *Buffer, DWORD BufSize);
void __fastcall WriteBool(const TCNString Name, bool Value);
void __fastcall WriteFloat(const TCNString Name, double Value);
void __fastcall WriteInteger(const TCNString Name, DWORD Value);
void __fastcall WriteString(const TCNString Name, const TCNString Value);
void __fastcall WriteExpandString(const TCNString Name, const TCNString Value);
void __fastcall SetRootKey(HKEY Value);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -