VC操作登錄檔

2021-04-13 11:01:24 字數 1814 閱讀 8606

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=::regdeletekey(hkey,"sqladdress");

long ret0=::regdeletevalue(hkey,"sqladdress");

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

long ret2=::regdeletevalue(hkey,"sqlpwd");

long ret3=::regdeletevalue(hkey,"**sname");

long ret4=::regdeletevalue(hkey,"**spwd");

if(ret1!=error_success||ret2!=error_success||ret3!=error_success||ret4!=error_success)

2.vc寫登錄檔資訊:

hkey hkey;

lpctstr data_set="software//yeete//**s";

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

//查詢sql位址

lpbyte sqladd_get=new byte[80];

dword type_1=reg_sz ; dword cbdata_1=80;

long ret1=::regqueryvalueex(hkey, "sqladdress", null, &type_1, sqladd_get, &cbdata_1);

// 查詢sql使用者名稱

lpbyte sqlname_get=new byte [80];

dword type_2=reg_sz; dword cbdata_2=80;

long ret2=::regqueryvalueex(hkey, "sqlname", null,&type_2,sqlname_get,&cbdata_2);

// 查詢sql密碼

dword cbdata_3=80;

lpbyte sqlpass_get=new byte [80];

long ret3=::regqueryvalueex(hkey, "sqlpwd", null,&type_2,sqlpass_get,&cbdata_3);

//查詢**s使用者名稱

dword cbdata_4=80;

lpbyte **sname_get=new byte [80];

long ret4=::regqueryvalueex(hkey, "**sname", null,&type_2,**sname_get,&cbdata_4);

//查詢**s密碼

dword cbdata_5=80;

lpbyte **spwd_get=new byte [80];

long ret5=::regqueryvalueex(hkey, "**spwd", null,&type_2,**spwd_get,&cbdata_5);

if(ret0!=error_success||ret1!=error_success||ret2!=error_success||ret3!=error_success||ret4!=error_success||ret5!=error_success)

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 登錄檔操作

獲取登錄檔值 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 d...

VC操作登錄檔

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