Skip to content
⌘ NSIS Forum Archive

Add Link to Components Page

9 posts

markfsi#

Add Link to Components Page

I'm attempting to add a link to the "Components Page" but I can't seem to figure it out.

Similar to this example:


But this example pertains to the "Welcome Page"

Any help would be appreciated.

Thanks!
MSG#
That example assumes you're using MUI1. If you're using MUI2, you can add a link control for example through editing the appriopriate header file in NSIS\Contrib\Modern UI 2.
Afrow UK#
Using Resource Hacker with Linker should be the only way. The components page does not use nsDialogs.

Stu
jiake#
You may use the System plugin to create one:
Before creating, first you should get the position of another control and calculate a position using the gotten coordinate for the new control.

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 control_id
!insertmacro GetDlgItemRect $1 $2 $3 $4 $0 $1
IntOp $2 $2 + 15
!insertmacro CreateLinker "View my site" $1 $2 50 8 $0 1600 "http://xxx.xxx.xxx/"

Maybe you would destroy some control and put yours there:
GetDlgItem $1 $0 control_id
System::Call 'User32:😁estroyWindow(i r1)'

Some macro written by bluenet:

ButtonLinker plugin is a joint one with the ButtonEvent and the Linker plugin.
In the following macro, you may replace it with the linker plugin.



!macro GetDlgItemRect OUT_LEFT OUT_TOP OUT_RIGHT OUT_BOTTOM HWNDDLG HWNDCTL
    Push ${HWNDCTL}
    Push ${HWNDDLG}
    Exch $R0 ;HWND
    Exch
    Exch $R1 ;handle of control
    Push $R2
    System::Call /NOUNLOAD "*(i, i, t, i, i, i, i, i, i, i, i) i.s"
    Pop $R2
    System::Call /NOUNLOAD 'User32::GetWindowRect(i, i) i (R1, R2)'
    System::Call /NOUNLOAD 'User32::ScreenToClient(i, i) i (R0, R2)'
    IntOp $R1 $R2 + 8 ;sizeof(LPPOINT)*2 = 8
    System::Call /NOUNLOAD 'User32::ScreenToClient(i, i) i (R0, R1)'
    Exch 2
    Pop $R0
    Pop $R1
    System::Call /NOUNLOAD "*$R2(i .s, i .s, i .s, i .s)"
    System::Free $R2
    Exch 4
    Pop $R2
    Pop ${OUT_TOP}
    Pop ${OUT_RIGHT}
    Pop ${OUT_BOTTOM}
    Pop ${OUT_LEFT}
!macroend 
!macro CreateLinker TEXT LEFT TOP WIDTH HEIGHT HWNDPARENT CTLID LINKADD
    System::Call /NOUNLOAD 'Kernel32::GetModuleHandle(t) i (0) .s'
    ;Style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
    System::Call 'User32::CreateWindowEx(i,t,t,i,i,i,i,i,i,i,i,v) i (0,"STATIC","${TEXT}",0x54000000,${LEFT},${TOP},${WIDTH},${HEIGHT},${HWNDPARENT},${CTLID},s,0) .s'
    Exch $R0
    Push $R1
    CreateFont $R1 $(^Font) $(^FontSize)
    SendMessage $R0 ${WM_SETFONT} $R1 0
    GetDlgItem $R2 ${HWNDPARENT} ${CTLID}
    ButtonLinker::CreateLinker /NOUNLOAD $R2 ${LINKADD}
    Pop $R2
    Pop $R1
    Pop $R0
!macroend 
jiake#edited
I write an example. It destroy the "Space Required" text on components page and create a link there.
This example needs the "Linker" plugin. If you don't have this plugin, download it yourself first.
theaskingman#
hi,
I need exactly this for my MUI2 Installation.
Unfortunalety, your example isn't working on my system ("go to google" is shown, but nothing happens when I click on it)
Windows Vista, latest nsis installation, linker 1.1 plugin
MSG#
The zip with version 1.1 of the linker plug-in is no longer online, and I can't find it with google. Could someone please recompile and reupload it, preferably directly into the wiki this time?



Edit: Or maybe someone still has v1.1 lying around and can upload it?
tony18#
Thanx a lot, Jiake!
Would you please add an example with a button instead of link?
Many thanks.