inno-setup – Inno Setup – 如何编辑“关于设置”对话框文本框
发布时间:2020-12-15 09:05:02 所属栏目:大数据 来源:网络整理
导读:我需要编辑或替换Inno Setup的About Setup对话框文本中的文本. 这是一张图片: 在互联网上看到我得到这个代码: [Setup]AppName=My ProgramAppVerName=My Program v 1.5DefaultDirName={pf}My ProgramOutputDir=.[Languages]Name: "default"; MessagesFile:
我需要编辑或替换Inno Setup的About Setup对话框文本中的文本.
这是一张图片: 在互联网上看到我得到这个代码: [Setup] AppName=My Program AppVerName=My Program v 1.5 DefaultDirName={pf}My Program OutputDir=. [Languages] Name: "default"; MessagesFile: "compiler:Default.isl" [Files] Source: CallbackCtrl.dll; Flags: dontcopy [Code] type TWFProc = function(h:hWnd;Msg,wParam,lParam:Longint):Longint; function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam: Longint; lParam: Longint): Longint; external 'CallWindowProcA@user32.dll stdcall'; function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall'; function WrapWFProc(Callback: TWFProc; ParamCount: Integer): Longword; external 'wrapcallbackaddr@files:CallbackCtrl.dll stdcall'; var OldProc:Longint; procedure AboutSetupClick; begin //Edit your text here MsgBox('CUSTOM TEXT HERE',mbInformation,MB_OK); end; function WFWndProc(h:HWND;Msg,lParam:Longint):Longint; begin if (Msg=$112) and (wParam=9999) then begin Result:=0; AboutSetupClick; end else begin if Msg=$2 then SetWindowLong(WizardForm.Handle,-4,OldProc); Result:=CallWindowProc(OldProc,h,Msg,lParam); end; end; procedure InitializeWizard; begin OldProc:=SetWindowLong(WizardForm.Handle,WrapWFProc(@WFWndProc,4)); end; 似乎工作正常.. 但如果我关闭安装程序,我会收到崩溃消息. 我需要帮助来修复此代码或提供更好的示例来更改“关于设置”对话框文本框中的文本. 我使用的DLL. 解决方法
在退出安装应用程序之前,需要将保存的原始Windows过程返回到向导表单.为此,请使用以下内容:
const GWL_WNDPROC = -4; procedure DeinitializeSetup; begin SetWindowLong(WizardForm.Handle,GWL_WNDPROC,OldProc); end; 无论如何,您可以使用更可靠的库来包装回调,即 [Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}My Program OutputDir=userdocs:Inno Setup Examples Output [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!',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,lParam); end; procedure InitializeWizard; begin OldWndProc := SetWindowLong(WizardForm.Handle,WrapWindowProc(@WndProc,4)); end; procedure DeinitializeSetup; begin SetWindowLong(WizardForm.Handle,OldWndProc); end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |