请教:循环读取注册表
ww425 2005-09-01 02:45:03 大家好!问题如下:
注册表如下:
0 REG_SZ ewtwt
1 REG_SZ ewehfgj
... ... ...
n REG_SZ jtykjty
我能不能写个循环读取?我写了一个,可是只能读第一个0的键值
DWORD type_2=REG_SZ ; DWORD cbData_2=80;
for(int i=0; i<20;i++)
{
LPBYTE product_Get=new BYTE[80];
str_temp.Format("%d", i);
long ret2=::RegQueryValueEx(hKEY, str_temp, NULL,&type_2,product_Get, &cbData_2);
CString buf = CString(product_Get);
AfxMessageBox(VendorID);
delete[] product_Get;
}