VC 登錄檔操作

2021-04-30 23:38:04 字數 1374 閱讀 2861

//獲取登錄檔值

hkey hkey;

lpctstr data_set="software//internet";

long ret0=::regopenkeyex(hkey_local_machine,data_set, 0, key_all_access, &hkey);

lpbyte lpa = new byte[500];

dword dwaidsize=500;

dword type=reg_sz;

long ret1=::regqueryvalueex(hkey,"123",null,&type,lpa,&dwaidsize);

long ret2=::regclosekey(hkey);

//設定登錄檔值

hkey hkey;

lpctstr data_set="software//microsoft//internet explorer//*******";

long ret0=::regopenkeyex(hkey_local_machine,data_set, 0, key_all_access, &hkey);

bool value=0;

long ret1=::regsetvalueex(hkey,"",0,reg_binary,(lpbyte) &value,sizeof(value));

long ret2=::regclosekey(hkey);

//刪除登錄檔值

hkey hkey;

lpctstr data_set="software//microsoft//internet explorer//*******";

long ret0=::regopenkeyex(hkey_local_machine,data_set, 0, key_all_access, &hkey);

long ret1=::regdeletevalue(hkey,"123123");

long ret2=::regclosekey(hkey);

//建立登錄檔值

hkey hkey;

lpctstr data_set="software//microsoft//internet explorer//*******";

// 開啟登錄檔父目錄,取得控制代碼

long ret0=::regopenkeyex(hkey_local_machine,data_set, 0, key_all_access, &hkey);

bool value=0;

long ret1=::regsetvalueex(hkey,"123123",0,reg_binary,(lpbyte) &value,sizeof(value));

long ret2=::regclosekey(hkey);

VC操作登錄檔

1.vc讀取登錄檔資訊 hkey hkey lpctstr data set software yeete s long ret5 regopenkeyex hkey local machine,data set,0,key write key read,hkey long ret0 regdele...

VC操作登錄檔

vc操作登錄檔 邵盛松 2010 3 2 新增標頭檔案atlbase.h 寫入登錄檔鍵值 以設定字串值為例 cstring strpath t c name.exe cregkey key if key.create hkey local machine,t software microsoft w...

VC操作登錄檔

日誌原文 編寫軟體登錄檔的讀寫是基本的操作,這裡直接將源 貼出來,大家共享並擴充套件,希望大家還可以回來,將您的 貼出來,共同進步,這裡對的幫助表示感謝。regop.cpp implementation of the regop class.註冊軟體 include stdafx.h include...