随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253


代码文件:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Registry;

procedure TForm1.Button1Click(Sender: TObject);
var
  reg: TRegistry;
  s: string;
begin
  reg := TRegistry.Create;
  reg.RootKey := HKEY_CURRENT_USER;
  reg.OpenKey('Software\Microsoft\Internet Explorer\Main', False); {参数2为True时,会创建缺失}
  //reg.OpenKeyReadOnly('Software\Microsoft\Internet Explorer\Main'); {只读打开}
  s := reg.ReadString('Start Page');
  ShowMessage(s); {http://del.cnblogs.com/}
  reg.CloseKey;
  reg.Free;
end;

end.

posted on 2008-08-23 22:18  万一  阅读(...)  评论(...编辑  收藏