我想在安装好程序文件(路径可由用户选择)后, 还要安装一个项目文件夹,而这个文件夹的路径可以由用户选择,而且卸载程序时,这个文件夹也能一并卸载.
我看到有的帖子说,直接写在[Files]里面,先安装程序文件目录下,然后在[Code]段把这些文件复制到目标位置(用户选择的路径).但是我对pascal很陌生,也找不到可以参考的代码,不知道具体如何实现.
望知者赐教.先谢过.

解决方案 »

  1.   

    。net打包安装程序不就可以吗,不过卸载的时候就要调用一个卸载exe(具体叫什么名字,网上搜索下),指定产品guid号,就可以卸载
      

  2.   

    参考下 多路径安装 对所有安装项可以分别设置路径
    由于只是一个安装包,当然可以一次性全部卸载
    以下主程序和工程文件,两个目录.
    ================
    [Code]
    var
    Mingwdir: TLabel;
    Msysdir: TLabel;
    BitmapImage1: TBitmapImage;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Button2: TButton;
    NewStaticText1: TNewStaticText;
    NewStaticText2: TNewStaticText;procedure ChoseMingwFoldersClick(Sender: TObject);
    var
    choicedDIR:String;
    begin
    if BrowseForFolder(ExpandConstant('{cm:choicedir,主程序}'),choicedDIR,True) then
       Edit1.Text := choicedDIR;
    end;procedure ChoseMsysFoldersClick(Sender: TObject);
    var
    choicedDIR:String;
    begin
    if BrowseForFolder(ExpandConstant('{cm:choicedir,工程文件}'),choicedDIR,True) then
       Edit2.Text := choicedDIR;
    end;procedure choicedir_Activate(Page: TWizardPage);
    begin
    end;function choicedir_ShouldSkipPage(Page: TWizardPage): Boolean;
    begin
    Result := False;
    end;function choicedir_BackButtonClick(Page: TWizardPage): Boolean;
    begin
    Result := True;
    end;function choicedir_NextButtonClick(Page: TWizardPage): Boolean;
    begin
    Result := True;
    end;procedure choicedir_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean);
    begin
    end;function choicedir_CreatePage(PreviousPageId: Integer): Integer;
    var
    Page: TWizardPage;
    begin
    Page := CreateCustomPage(
        PreviousPageId,
        ExpandConstant('{cm:choicedirCaption}'),
        ExpandConstant('{cm:choicedirDescription,{cm:Packagename}}')
    );{ Mingwdir }
    Mingwdir := TLabel.Create(Page);
    with Mingwdir do
    begin
        Parent := Page.Surface;
        Left := ScaleX(0);
        Top := ScaleY(88);
        Width := ScaleX(24);
        Height := ScaleY(16);
        
        Caption := ExpandConstant('{cm:installedDir,主程序}') ;
        Font.Color := -16777208;
        Font.Height := ScaleY(-13);
        Font.Name := 'Tahoma';
        Font.Style := [fsBold];
    end;{ Msysdir }
    Msysdir := TLabel.Create(Page);
    with Msysdir do
    begin
        Parent := Page.Surface;
        Left := ScaleX(0);
        Top := ScaleY(160);
        Width := ScaleX(24);
        Height := ScaleY(16);
        Caption := ExpandConstant('{cm:installedDir,工程文件}') ;
        Font.Color := -16777208;
        Font.Height := ScaleY(-13);
        Font.Name := 'Tahoma';
        Font.Style := [fsBold];
    end;{ BitmapImage1 }
    BitmapImage1 := TBitmapImage.Create(Page);
    with BitmapImage1 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(8);
        Top := ScaleY(8);
        Width := ScaleX(57);
        Height := ScaleY(41);
    end;
    { Edit1 }
    Edit1 := TEdit.Create(Page);
    with Edit1 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(16);
        Top := ScaleY(112);
        Width := ScaleX(313);
        Height := ScaleY(21);
        TabOrder := 0;
        Text := 'C:\Program Files';
    end;{ Edit2 }
    Edit2 := TEdit.Create(Page);
    with Edit2 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(16);
        Top := ScaleY(184);
        Width := ScaleX(313);
        Height := ScaleY(21);
        TabOrder := 1;
        Text := 'C:';
    end;{ Button1 }
    Button1 := TButton.Create(Page);
    with Button1 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(336);
        Top := ScaleY(112);
        Width := ScaleX(75);
        Height := ScaleY(23);
        Caption :=ExpandConstant('{cm:Button1Browse}');
        TabOrder := 2;
        OnClick := @ChoseMingwFoldersClick;
    end;{ Button2 }
    Button2 := TButton.Create(Page);
    with Button2 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(336);
        Top := ScaleY(184);
        Width := ScaleX(75);
        Height := ScaleY(23);
        Caption := ExpandConstant('{cm:Button2Browse}');
        TabOrder := 3;
        OnClick := @ChoseMsysFoldersClick;
    end;{ NewStaticText1 }
    NewStaticText1 := TNewStaticText.Create(Page);
    with NewStaticText1 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(16);
        Top := ScaleY(16);
        Width := ScaleX(22);
        Height := ScaleY(17);
        Caption := ExpandConstant('{cm:SelectDirLabel,{cm:Packagename}}');
        Font.Color := -16777208;
        Font.Height := ScaleY(-13);
        TabOrder := 4;
    end;{ NewStaticText2 }
    NewStaticText2 := TNewStaticText.Create(Page);
    with NewStaticText2 do
    begin
        Parent := Page.Surface;
        Left := ScaleX(16);
        Top := ScaleY(50);
        Width := ScaleX(22);
        Height := ScaleY(17);
    //    Caption := '单击“下一步”继续。如果你想选择其它文件夹,请单击“浏览”。';
        Caption := ExpandConstant('{cm:SelectDirBrowseLabel,{cm:Packagename}}');
        Font.Color := -16777208;
    end;
    with Page do
    begin
        OnActivate := @choicedir_Activate;
        OnShouldSkipPage := @choicedir_ShouldSkipPage;
        OnBackButtonClick := @choicedir_BackButtonClick;
        OnNextButtonClick := @choicedir_NextButtonClick;
        OnCancelButtonClick := @choicedir_CancelButtonClick;
    end;Result := Page.ID;
    end;function getProgDir(Param: String): String;
    begin
    Result := Edit1.Text+'\我的程序';
    end;function getProjDir(Param: String): String;
    begin
    Result := Edit2.Text;
    end;procedure InitializeWizard();
    begin
    choicedir_CreatePage(wpUserInfo);
    end;
      

  3.   

    @Forknow
    上回我的Inno setup也是你結的,高手