我需要取得控制面板中区域设置中的日期分隔符。发现它们在注册表中的如下键值中。HKEY_CURRENT_USER\Control Panel\International\sDate 或
HKEY_USERS\.DEFAULT\Control Panel\International\sDate如何在Delphi中取得这个键值呢?
请给出具体的代码。

解决方案 »

  1.   

    1. 如果是默认健值,则直接用    str := reg.ReadString(''); 
    2. 如果还是有问题,是不是你要查找的是Acrobat Reader, 
      if reg.OpenKey('SOFTWARE\Adobe\Acrobat Reader\5.0\InstallPath' ,false) then 
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var 
      str: string; 
      Reg: TRegistry; 
    begin 
      Reg := TRegistry.Create; 
      Reg.RootKey := HKEY_LOCAL_MACHINE; 
      if reg.OpenKey('SOFTWARE\Adobe\Adobe Acrobat\5.0\InstallPath' ,false) then 
        str := reg.ReadString(''); 
      edit1.text := str; 
      Reg.Free; 
    end. 先引用
      

  2.   

    日期的分隔符用不着那么麻烦,Delphi已经替你做了。
    直接读写DateSeparator就是了。
      

  3.   

    var
         MyReg:TRegistry;
         StrReadValue :string;
    begin Myreg.RootKey:=HKEY_CURRENT_USER;
         StrReadValue:='';
         if Myreg.OpenKey('Control Panel\International',false) then
            begin
              StrReadValue:=Myreg.ReadString('sDate');
           end;
       Finally
          Myreg.Free;
       end;
      

  4.   

    Reg.RootKey := HKEY_LOCAL_MACHINE;
        if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion', True) then
          begin
            RegStr:=reg.ReadString('zcm');
      

  5.   

    procedure GetUseMessage();
    var
    regemp:tregistry;
    begin
      regemp:=TRegistry.Create ;
      With regemp do   ///从注册表中读取用户信息
              begin
                  RootKey :=HKEY_LOCAL_MACHINE ;
                   if OpenKey('HKEY_CURRENT_USER\Control Panel\International\sDate ',true) then
                    begin
                       if ValueExists ('gc_vale') then
                          begin
                            ShowMessage ('此用户还没有注册');
                            exit;
                          end
                          else
                          begin                    
                          a:=ReadString('');
                          b:=ReadString('');
                       c:=ReadString('');
                     d:=ReadString('');                     
                          end;
                    end;
              end;
              regemp.Free ;
      end;
      

  6.   

    上面的代码都可以实现你的功能
    但是千万别忘了在use 单元引用 registry
    否则要出错