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

操作注册表?

楼主kentmen()2002-06-12 09:10:21 在 C++ Builder / 基础类 提问

如何读写修改注册表?怎么判断什么系统? 问题点数:50、回复次数:3Top

1 楼40Star(斯文、大方、有前途)回复于 2002-06-12 09:14:18 得分 0

GetVersion  
  The   GetVersion   function   returns   the   current   version   number   of   the   operating   system.    
   
  Note     This   function   has   been   superseded   by   GetVersionEx.   New   applications   should   use   GetVersionEx   or   VerifyVersionInfo.    
   
  DWORD   GetVersion(VOID);  
  Parameters  
  This   function   has   no   parameters.    
   
  Return   Values  
  If   the   function   succeeds,   the   return   value   is   a   DWORD   value   that   contains   the   major   and   minor   version   numbers   of   the   operating   system   in   the   low   order   word,   and   information   about   the   operating   system   platform   in   the   high   order   word.    
   
  For   all   platforms,   the   low   order   word   contains   the   version   number   of   the   operating   system.   The   low-order   byte   of   this   word   specifies   the   major   version   number,   in   hexadecimal   notation.   The   high-order   byte   specifies   the   minor   version   (revision)   number,   in   hexadecimal   notation.    
   
  To   distinguish   between   operating   system   platforms,   use   the   high   order   bit   and   the   low   order   byte,   as   shown   in   the   following   table:  
   
  Platform   High-order   bit   Low-order   byte   (major   version)    
  Windows   NT/2000   0   3,   4,   or   5    
  Windows   95/98   1     4    
  Win32s   with    
  Windows   3.1   1   3    
   
   
  Windows   NT/2000:   The   remaining   bits   in   the   high-order   word   specify   the   build   number.    
   
  Windows   95/98:   The   remaining   bits   of   the   high-order   word   are   reserved.  
   
  Remarks  
  The   GetVersionEx   function   was   developed   because   many   existing   applications   err   when   examining   the   packed   DWORD   value   returned   by   GetVersion,   transposing   the   major   and   minor   version   numbers.   GetVersionEx   forces   applications   to   explicitly   examine   each   element   of   version   information.   VerifyVersionInfo   eliminates   further   potential   for   error   by   comparing   the   required   system   version   with   the   current   system   version   for   you.    
   
  The   following   code   fragment   illustrates   how   to   extract   information   from   the   GetVersion   return   value:  
   
  dwVersion   =   GetVersion();  
     
  //   Get   the   Windows   version.  
   
  dwWindowsMajorVersion   =     (DWORD)(LOBYTE(LOWORD(dwVersion)));  
  dwWindowsMinorVersion   =     (DWORD)(HIBYTE(LOWORD(dwVersion)));  
   
  //   Get   the   build   number   for   Windows   NT/Windows   2000   or   Win32s.  
   
  if   (dwVersion   <   0x80000000)                                 //   Windows   NT/2000  
          dwBuild   =   (DWORD)(HIWORD(dwVersion));  
  else   if   (dwWindowsMajorVersion   <   4)                 //   Win32s  
          dwBuild   =   (DWORD)(HIWORD(dwVersion)   &   ~0x8000);  
  else                                     //   Windows   95/98   --   No   build   number  
          dwBuild   =     0;  
  Top

2 楼40Star(斯文、大方、有前途)回复于 2002-06-12 09:16:57 得分 50

看看TRegistry  
   
  //写入注册表--启动系统时再现  
  AnsiString   S;  
  TRegistry   *Registry   =   new   TRegistry;  
  Registry->RootKey   =   HKEY_LOCAL_MACHINE;  
  //   如果此键不存在则自动创建  
  Registry->OpenKey("\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",true);  
  S   =   Registry->ReadString("40Star");  
  if   (S!=Application->ExeName)  
  {  
  Registry->WriteString("40Star",Application->ExeName);  
  Registry->CloseKey();  
  }  
  delete   Registry;Top

3 楼Libran()回复于 2002-06-12 09:33:15 得分 0

读写注册表用TRegistry类,看看帮助  
  要注意的是使用TRegistry类需包含头文件:  
  #include   <Registry.hpp>Top

4 楼sluizin(冰封箭)回复于 2002-06-12 09:40:01 得分 0

同意楼上。Top

5 楼Libran()回复于 2002-06-12 09:58:38 得分 0

读写注册表用TRegistry类  
  要注意的是使用TRegistry类需包含头文件  
  #include   <Registry.hpp>Top

相关问题

  • 操作注册表
  • 注册表操作
  • 注册表操作
  • 如何操作注册表?
  • C#的注册表操作
  • delphi中操作注册表
  • 注册表操作问题!
  • 关于注册表操作
  • 注册表操作问题!
  • 操作注册表问题

关键词

  • win32
  • word
  • nt
  • application
  • 注册表
  • getversion
  • dwversion
  • getversionex
  • registry
  • version

得分解答快速导航

  • 帖主:kentmen
  • 40Star

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

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