const<br> KeyName = '/Software/Microsoft/Windows/CurrentVersion/Explorer/Advanced';<br>var Key : TRegistry;<br> i: integer;<br>begin<br> Key := TRegistry.Create;<br> Key.RootKey := HKEY_CURRENT_USER;<br> If Key.OpenKey(KeyName,False) then begin<br> i := key.readInteger('HideFileExt');//取得当前的设置值<br> Key.Write('HideFileExt',1-i); //开关设置,是1则变0,是0则变1<br> end else<br> ShowMessage('打不开主键!');<br> Key.Free;<br>end;<br>