VC 高效 快速給REG DWORD賦值

2021-07-14 21:53:08 字數 1004 閱讀 6071

//鬱悶了好久,得來不易,給後來的兄弟省點時間

#include //shsetvalue標頭檔案

#pragma comment(lib, "shlwapi.lib") //shsetvalue庫檔案

函式原型:

lstatus shsetvalue(

_in_ hkey hkey,

_in_opt_ lpctstr pszsubkey,

_in_opt_ lpctstr pszvalue,

_in_ dword dwtype,

_in_opt_ lpcvoid pvdata,

_in_ dword cbdata

);dword dwvalue = 1;// 1 就是你要賦的值

//給 hkey_current_user\software\policies\microsoft\test 項下的 **** 鍵賦 1 值

shsetvalue(hkey_current_user, "software\\policies\\microsoft\\test", "****", reg_dword, &dwvalue, sizeof(dword));

//傳統的方法//

hkey hkey;

hkey hkeyroot = hkey_current_user;

long ret0=(::regopenkeyex(hkeyroot,"software\\policies\\microsoft\\test",0,key_all_access,&hkey));

if(ret0!=error_success)//如果無法開啟hkey,則中止程式的執行

dword dwlasterror;

dwlasterror = 1;

if (regsetvalueex( hkey, "****", 0,reg_dword,(lpbyte)&dwlasterror ,sizeof(dword)))

給VC程式換面板

2.在左邊的fileview卡片裡面,在resource files欄目加入skinmagiclib.lib,在fileview卡片裡面加入skinmagiclib.件,並在stdafx.h中加入 include skinmagiclib.h verify 1 initskinmagiclib af...

快速了解《如何高效學習》

學習策略有很多 諸如閱讀方法 提問方法等等 應該多去尋找學習方法,把優秀的學習方法整合到自己的學習策略中,通過不斷的整合和實踐,最終找到適合自己的學習理論和策略。獲取 理解 擴充套件 糾錯 應用 第一步 選擇要學習的概念 首先選好你打算深入理解的概念,拿一張空白紙,在最上方寫下概念的名稱。第二步 設...

mysql快速高效建立索引

有乙個問題,一張表有3百萬條記錄,隨著時間的增加,記錄量會更多,此時查詢速度很慢。在建立此表前沒有未相應字段新增索引,所以此時需要為表新增索引。但是因為資料量大的原因,索引新增不成功,想了很多辦法,終於在短時間內解決了。辦法如下 1 進入mysql介面。mysql uroot hlocalhost ...