本文介绍了如何读取registrykey REG_DWORD值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DWORD dwType = REG_DWORD;
size1=1024;
if((RegQueryValueEx(keyHandle,"Value",NULL,&dwType,(LPBYTE)rgValue1,&size1))
SetDlgItemText(IDC_EDIT, rgValue1);
我想读取一个DWORD类型的registrykey(值)并希望在编辑框中显示它,但RegQueryValueEx函数返回空值。请帮助我
I want to read a registrykey(value) which is of DWORD type and want to display it in the editbox but RegQueryValueEx function returns empty value.please help me
推荐答案
ERROR_SUCCESS 0 (0x0)
如果没有发生错误!
您需要更改
if no errors occurs!
You need to change
if((RegQueryValueEx(keyHandle,"Value",NULL,&dwType,(LPBYTE)rgValue1,&size1))
with
with
if(RegQueryValueEx(keyHandle,"Value",NULL,&dwType,(LPBYTE)rgValue1,&size1 == ERROR_SUCCESS)
DWORD dwData;
DWORD cbData = sizeof(DWORD);
DWORD dwRet;
dwRet = RegQueryValueEx( HKEY_PERFORMANCE_DATA,
TEXT("Global"),
NULL,
NULL,
(LPBYTE)&dwData,
&cbData );
这篇关于如何读取registrykey REG_DWORD值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!