Archive: Adding a custom button to the components page


Adding a custom button to the components page
  Hello!
How do i add a custom button to the standard components page?
I found the solution using ButtonEvent.dll
But the button works only at the bottom of the page.
If i change Y pos to 200, the button doesnt work. Please help


"MUI2.nsh"


>!define IDC_ABOUT 1300

>!define MUI_COMPONENTSPAGE_SMALLDESC

Name "Example1"
>OutFile "example1.exe"

>!define MUI_PAGE_CUSTOMFUNCTION_SHOW "CompShowProc"
>!insertmacro MUI_PAGE_COMPONENTS
>!insertmacro MUI_PAGE_INSTFILES

>!insertmacro MUI_LANGUAGE "English"


>Function CompShowProc

System
::Call 'user32::CreateWindowEx(i0,t"Button",t"Add Host",i${BS_PUSHBUTTON}|${WS_CHILD}|${WS_VISIBLE}|${WS_TABSTOP},i80,i300,i90,i25,i$HWNDPARENT,i${IDC_ABOUT},ir0,i0)i.R0'

CreateFont $0 '$(^Font)' '$(^FontSize)'
SendMessage $R0 ${WM_SETFONT} $0 0
GetFunctionAddress$0 FuncAbout
ButtonEvent::AddEventHandler /NoUnload ${IDC_ABOUT} $0

FunctionEnd

>Function FuncAbout

;0x40=MB_OK(0x0)|MB_ICONINFORMATION(0x40)
System::Call 'user32::MessageBox(i$HWNDPARENT,t"It works!",t"About",i0x40)'

>FunctionEnd


Section "Component1"
>SectionEnd

Section "Component2"
>SectionEnd

Section "Component3"
>SectionEnd
>

I suppose your button is covered by Inner dialog - move it somewhere else.

To create buttons inside Inner dialog's area use nsDialogs plug-in.


But nsDialogs allows creation of custom pages. I need to modify the standard components page


I've found the following article: http://stackoverflow.com/questions/1...-a-nsis-script
Can this help me to solve my problem?


That article helps you only a little.
nsDialogs indeed cannot create button in standard dialog.

Create button using ResHacker if you want to have it in a standard page.
Modify one of the .exe files in Contrib/UI folder (that one you use in your installer) and use ButtonEvent plug-in.