surfboy
驱动牛犊
驱动牛犊
  • 注册日期2009-09-23
  • 最后登录2009-09-24
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望11点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2175回复:0

如何使用RadioButton修改注册表?

楼主#
更多 发布于:2009-09-23 12:28
需要实现选择RadioButton1时注册表HKEY_LOCAL_MACHINE\SOFTWARE\SDR\user值为0
选择RadioButton2时注册表HKEY_LOCAL_MACHINE\SOFTWARE\SDR\user值为1,应该如何修改?

[CustomMessages]
CustomForm_Caption=CustomForm Caption
CustomForm_Description=CustomForm Description
CustomForm_RadioButton1_Caption0=RadioButton1
CustomForm_RadioButton2_Caption0=RadioButton2

[Code]
var
  RadioButton1: TRadioButton;
  RadioButton2: TRadioButton;

{ CustomForm_Activate }

procedure CustomForm_Activate(Page: TWizardPage);
begin
  // enter code here...
end;

{ CustomForm_ShouldSkipPage }

function CustomForm_ShouldSkipPage(Page: TWizardPage): Boolean;
begin
  Result := False;
end;

{ CustomForm_BackButtonClick }

function CustomForm_BackButtonClick(Page: TWizardPage): Boolean;
begin
  Result := True;
end;

{ CustomForm_NextkButtonClick }

function CustomForm_NextButtonClick(Page: TWizardPage): Boolean;
begin
  Result := True;
end;

{ CustomForm_CancelButtonClick }

procedure CustomForm_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean);
begin
  // enter code here...
end;

{ CustomForm_CreatePage }

function CustomForm_CreatePage(PreviousPageId: Integer): Integer;
var
  Page: TWizardPage;
begin
  Page := CreateCustomPage(
    PreviousPageId,
    ExpandConstant('{cm:CustomForm_Caption}'),
    ExpandConstant('{cm:CustomForm_Description}')
  );

{ RadioButton1 }
  RadioButton1 := TRadioButton.Create(Page);
  with RadioButton1 do
  begin
    Parent := Page.Surface;
    Caption := ExpandConstant('{cm:CustomForm_RadioButton1_Caption0}');
    Left := ScaleX(136);
    Top := ScaleY(40);
    Width := ScaleX(113);
    Height := ScaleY(17);
    TabOrder := 0;
  end;
  
  { RadioButton2 }
  RadioButton2 := TRadioButton.Create(Page);
  with RadioButton2 do
  begin
    Parent := Page.Surface;
    Caption := ExpandConstant('{cm:CustomForm_RadioButton2_Caption0}');
    Left := ScaleX(136);
    Top := ScaleY(80);
    Width := ScaleX(113);
    Height := ScaleY(17);
    TabOrder := 1;
  end;

  with Page do
  begin
    OnActivate := @CustomForm_Activate;
    OnShouldSkipPage := @CustomForm_ShouldSkipPage;
    OnBackButtonClick := @CustomForm_BackButtonClick;
    OnNextButtonClick := @CustomForm_NextButtonClick;
    OnCancelButtonClick := @CustomForm_CancelButtonClick;
  end;

  Result := Page.ID;
end;

{ CustomForm_InitializeWizard }

procedure InitializeWizard();
begin
  CustomForm_CreatePage(wpWelcome);
end;
游客

返回顶部