对于注册表的REG_SZ,REG_MULTIHE和REG_DWORD这几种类型,如何得知某个键属于哪一种类型呢?有什么API可以使用么?

解决方案 »

  1.   

    RegQueryValue
    Delphi TRegistry.GetDataType已经封装好了
      

  2.   

    使用  GetDataType函数,请参阅Delphi的帮助:   
        
      TRegistry.GetDataType   
        
      Returns   the   enumerated   data   type   of   a   specified   data   value   associated   with   the   current   key.     
        
      type   TRegDataType=   (rdUnknown,   rdString,   rdExpandString,   rdInteger,   rdBinary);   
      function   GetDataType(const   ValueName:   String):   TRegDataType;   
        
      Description   
        
      Call   GetDataType   to   determine   the   data   type   of   a   data   value   associated   with   the   current   key.   ValueName   is   a   string   containing   the   name   of   the   data   value   to   query.   
        
      GetDataType   returns   an   enumerated   value   of   type   TRegDataType.   TRegDataType   can   be   one   of   the   following   values   
        
      Value Meaning   
        
      rdUnknown Data   value   type   is   of   no   defined   value   type.   
      rdString Data   value   type   is   a   null-terminated   string.   It   is   a   Unicode   or   ANSI   string   depending   on   whether   the   application   calls   the   Unicode   or   ANSI   string   functions.   
      rdExpandString Data   value   type   is   a   null-terminated   string   that   contains   unexpanded   references   to   environment   variables   (for   example,   "%PATH%").   It   is   a   Unicode   or   ANSI   string   depending   on   whether   the   application   calls   the   Unicode   or   ANSI   string   functions.   
        
      rdInteger Data   value   type   is   a32-bit   number.   
      rdBinary Data   value   type   is   binary   data,   in   any   form.