CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

这样为什么不行?

楼主rememberME(wfj)2001-03-05 12:34:00 在 VC/MFC / 基础类 提问

RegOpenKeyEx(HKEY_LOCAL_MACHINE,   "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",   0,   KEY_ALL_ACCESS,   &hKey)  
  执行不成功,为什么?  
  问题点数:20、回复次数:5Top

1 楼xyzboat(一叶小舟)回复于 2001-03-05 12:43:00 得分 5

参数不对吧?  
  还可以用FormatMessage()输出错误信息.Top

2 楼xyzboat(一叶小舟)回复于 2001-03-05 12:44:00 得分 0

RegOpenKeyEx   和   RegOpenKey   是不一样的.Top

3 楼orbit(走了走了)回复于 2001-03-05 12:56:00 得分 15

改成:  
  RegOpenKeyEx(HKEY_LOCAL_MACHINE,   "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",   0,   KEY_ALL_ACCESS,   &hKey)  
  Top

4 楼rememberME(wfj)回复于 2001-03-05 13:08:00 得分 0

谢谢orbit,加分中。Top

5 楼111222(www.111222.cn)回复于 2001-03-05 13:10:00 得分 0

你没有MSDN,对吗?  
  我粘贴出来给你  
  RegOpenKeyEx  
  The   RegOpenKeyEx   function   opens   the   specified   key.    
   
  LONG   RegOpenKeyEx(  
      HKEY   hKey,                   //   handle   to   open   key  
      LPCTSTR   lpSubKey,     //   address   of   name   of   subkey   to   open  
      DWORD   ulOptions,       //   reserved  
      REGSAM   samDesired,   //   security   access   mask  
      PHKEY   phkResult         //   address   of   handle   to   open   key  
  );  
     
  Parameters  
  hKey    
  Handle   to   a   currently   open   key   or   any   of   the   following   predefined   reserved   handle   values:    
  HKEY_CLASSES_ROOT  
  HKEY_CURRENT_CONFIG  
  HKEY_CURRENT_USER  
  HKEY_LOCAL_MACHINE  
  HKEY_USERS  
  Windows   NT:   HKEY_PERFORMANCE_DATA    
  Windows   95   and   Windows   98:   HKEY_DYN_DATA    
   
  lpSubKey    
  Pointer   to   a   null-terminated   string   containing   the   name   of   the   subkey   to   open.   If   this   parameter   is   NULL   or   a   pointer   to   an   empty   string,   the   function   will   open   a   new   handle   to   the   key   identified   by   the   hKey   parameter.   In   this   case,   the   function   will   not   close   the   handles   previously   opened.    
  ulOptions    
  Reserved;   must   be   zero.    
  samDesired    
  Specifies   an   access   mask   that   describes   the   desired   security   access   for   the   new   key.   This   parameter   can   be   a   combination   of   the   following   values:   Value   Meaning    
  KEY_ALL_ACCESS   Combination   of   KEY_QUERY_VALUE,   KEY_ENUMERATE_SUB_KEYS,   KEY_NOTIFY,   KEY_CREATE_SUB_KEY,   KEY_CREATE_LINK,   and   KEY_SET_VALUE   access.    
  KEY_CREATE_LINK   Permission   to   create   a   symbolic   link.    
  KEY_CREATE_SUB_KEY   Permission   to   create   subkeys.    
  KEY_ENUMERATE_SUB_KEYS   Permission   to   enumerate   subkeys.    
  KEY_EXECUTE   Permission   for   read   access.    
  KEY_NOTIFY   Permission   for   change   notification.    
  KEY_QUERY_VALUE   Permission   to   query   subkey   data.    
  KEY_READ   Combination   of   KEY_QUERY_VALUE,   KEY_ENUMERATE_SUB_KEYS,   and   KEY_NOTIFY   access.    
  KEY_SET_VALUE   Permission   to   set   subkey   data.    
  KEY_WRITE   Combination   of   KEY_SET_VALUE   and   KEY_CREATE_SUB_KEY   access.    
   
   
  phkResult    
  Pointer   to   a   variable   that   receives   a   handle   to   the   opened   key.   When   you   no   longer   need   the   returned   handle,   call   the   RegCloseKey   function   to   close   it.    
  Return   Values  
  If   the   function   succeeds,   the   return   value   is   ERROR_SUCCESS.  
   
  If   the   function   fails,   the   return   value   is   a   nonzero   error   code   defined   in   WINERROR.H.   You   can   use   the   FormatMessage   function   with   the   FORMAT_MESSAGE_FROM_SYSTEM   flag   to   get   a   generic   description   of   the   error.  
   
  Remarks  
  Unlike   the   RegCreateKeyEx   function,   the   RegOpenKeyEx   function   does   not   create   the   specified   key   if   the   key   does   not   exist   in   the   registry.    
   
  QuickInfo  
      Windows   NT:   Requires   version   3.1   or   later.  
      Windows:   Requires   Windows   95   or   later.  
      Windows   CE:   Requires   version   1.0   or   later.  
      Header:   Declared   in   winreg.h.  
      Import   Library:   Use   advapi32.lib.  
      Unicode:   Implemented   as   Unicode   and   ANSI   versions   on   Windows   NT.  
   
  See   Also  
  Registry   Overview,   Registry   Functions,   RegCloseKey,   RegCreateKeyEx,   RegDeleteKey,   RegOpenKey    
   
     
   
  Top

相关问题

  • 为什么这样??为什么这样??
  • 为什么这样???
  • 为什么这样?
  • 为什么这样?
  • 为什么,为什么会这样???
  • 为什么这样对我!!!
  • 为什么会这样DI?
  • 为什么会是这样
  • 为什么总是这样?
  • 为什么会这样!

关键词

  • access
  • regopenkeyex
  • hkey
  • handles
  • opened
  • key
  • current
  • reserved
  • local
  • function

得分解答快速导航

  • 帖主:rememberME
  • xyzboat
  • orbit

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo