Inno Setup - How to edit the “About Setup” dialog text box

后端 未结 1 1426
独厮守ぢ
独厮守ぢ 2021-01-03 05:43

I need to edit or replace the text in the About Setup dialog box text of Inno Setup.

Here is a picture:

相关标签:
1条回答
  • 2021-01-03 06:21

    You need to give the saved original windows procedure back to the wizard form before you exit the setup application. To do so, use something like this:

    const
      GWL_WNDPROC = -4;
    
    procedure DeinitializeSetup;
    begin
      SetWindowLong(WizardForm.Handle, GWL_WNDPROC, OldProc);
    end;
    

    Anyway, you can use more trustful library for wrapping callbacks, the InnoCallback library. I've made a review of the code you used and added support for Unicode InnoSetup versions, expecting the use of the InnoCallback library:

    [Files]
    Source: "InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy
    
    [Code]
    #ifdef UNICODE
      #define AW "W"
    #else
      #define AW "A"
    #endif
    const
      GWL_WNDPROC = -4;
      SC_ABOUTBOX = 9999;
      WM_SYSCOMMAND = $0112;
    
    type
      WPARAM = UINT_PTR;
      LPARAM = LongInt;
      LRESULT = LongInt;
      TWindowProc = function(hwnd: HWND; uMsg: UINT; wParam: WPARAM; 
        lParam: LPARAM): LRESULT;
    
    function CallWindowProc(lpPrevWndFunc: LongInt; hWnd: HWND; Msg: UINT; 
      wParam: WPARAM; lParam: LPARAM): LRESULT;
      external 'CallWindowProc{#AW}@user32.dll stdcall';  
    function SetWindowLong(hWnd: HWND; nIndex: Integer; 
      dwNewLong: LongInt): LongInt;
      external 'SetWindowLong{#AW}@user32.dll stdcall';    
    function WrapWindowProc(Callback: TWindowProc; ParamCount: Integer): LongWord;
      external 'wrapcallback@files:InnoCallback.dll stdcall'; 
    
    var
      OldWndProc: LongInt;
    
    procedure ShowAboutBox;
    begin
      MsgBox('Hello, I''m your about box!', mbInformation, MB_OK);
    end;
    
    function WndProc(hwnd: HWND; uMsg: UINT; wParam: WPARAM; 
      lParam: LPARAM): LRESULT;
    begin
      if (uMsg = WM_SYSCOMMAND) and (wParam = SC_ABOUTBOX) then
      begin
        Result := 0;
        ShowAboutBox;
      end
      else
        Result := CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
    end;
    
    procedure InitializeWizard;
    begin
      OldWndProc := SetWindowLong(WizardForm.Handle, GWL_WNDPROC, 
        WrapWindowProc(@WndProc, 4));
    end;
    
    procedure DeinitializeSetup;
    begin
      SetWindowLong(WizardForm.Handle, GWL_WNDPROC, OldWndProc);
    end;
    
    0 讨论(0)
提交回复
热议问题