谢谢啦..我已经找到代码了..<br><br>function LastPos(Needle: Char; Haystack: String): integer;<br>begin<br> for Result := Length(Haystack) downto 1 do<br> if Haystack[Result] = Needle then <br> Break;<br>end;<br><br>//删除项<br>function RegDelKey(RootKey: HKEY; Name: String): boolean;<br>var<br> SubKey: String;<br> n: integer;<br> hTemp: HKEY;<br>begin<br> Result := False;<br> n := LastPos('/', Name);<br> if n > 0 then<br>begin<br> SubKey := Copy(Name, 1, n - 1);<br> if RegOpenKeyEx(RootKey, PChar(SubKey), 0, KEY_WRITE, hTemp) = ERROR_SUCCESS then<br>begin<br> SubKey := Copy(Name, n + 1, Length(Name) - n);<br> Result := (RegDeleteKey(hTemp, PChar(SubKey)) = ERROR_SUCCESS);<br> RegCloseKey(hTemp);<br> end;<br> end;<br>end;