Settings | Sign in | Sign up

The author has 1 post.

【代码】VC2008判断一个注册表项是否存在

Floor 1 巨大八爪鱼 7/29/12 19:02

wchar_t ch[MAX_PATH]={' '};
ULONG size=MAX_PATH;
CRegKey reg;
reg.Open(HKEY_LOCAL_MACHINE,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run")); //在这里设定键名
reg.QueryStringValue(_T("aaa"),ch,&size); //在这里设定键名
reg.Close();
CString str=ch;
str.Trim();
if (str.IsEmpty())

  //不存在

else

  //存在

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.