• 大小: 2KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-02
  • 标签: c++  reg  

资源简介

封装了一个C++读写注册表的类,附带有测试用例

资源截图

代码片段和文件信息

#include “rw_reg.h“
#include 
#include 

#ifndef tcout
#ifdef _UNICODE
#define tcout std::wcout
#else
#define tcout std::cout
#endif
#endif

int main()
{
BOOL ret;
tstring strValue;
DWORD dwValue;

// read
ret = rw_reg::GetRegStr(_T(“txtfile\\shell\\open\\command“)  
_T(““) strValue 260 HKEY_CLASSES_ROOT);
assert(ret);
tcout<
ret = rw_reg::GetRegDWORD(_T(“Console“)
_T(“FullScreen“) dwValue HKEY_CURRENT_USER);
assert(ret);
tcout<
DWORD dwBytes = 2048;
BYTE* pBuf = new BYTE[dwBytes];
memset(pBuf 0  dwBytes);
ret = rw_reg::GetRegBinary(_T(“Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections“) 
_T(“DefaultConnectionSettings“) pBuf dwBytes HKE

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1718  2013-01-13 15:39  main.cpp
     文件        3598  2013-01-13 15:30  rw_reg.cpp
     文件        1587  2013-01-13 15:27  rw_reg.h

评论

共有 条评论