The author has 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
1599 0
【代码】VC2008判断一个注册表项是否存在
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 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

  //存在

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 1599 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 7/29/12 19:02
Announcements