代码如下 :
Key := TRegistry.Create;
s := 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Drivers';
  Key.OpenKeyReadOnly(s)   ;
  Result := Key.KeyExists('a');
  Key.Free;// 在注册表中查看 'a' 存在!请各位帮助!!!!

解决方案 »

  1.   

    把Rootkey设为HKEY_LOCAL_MACHINE
    把s设为'\System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Drivers'
      

  2.   

    同意楼上的Key := TRegistry.Create;
    Key.RootKey:=HKEY_LOCAL_MACHINE; //在这里增加根键值
     s := '\System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Drivers';
      Key.OpenKeyReadOnly(s);
      Result :=Key.KeyExists('a');
      Key.Free;
      

  3.   

    Key := TRegistry.Create;
    Key.RootKey := HKEY_LOCAL_MACHINE;
    s := 'System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Drivers';
      Key.OpenKeyReadOnly(s);  //Key.OpenKey(s,False);
      Result := Key.KeyExists(s);  //哪来的'a'
      Key.Free;