View Single Post
Old 23rd June 2010, 04:02   #5
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
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::DestroyWindow(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.
http://nsis.sourceforge.net/ButtonEvent_plug-in
http://nsis.sourceforge.net/Linker_plug-in

PHP Code:
!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 ;sizeof(LPPOINT)*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 
PHP Code:
!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 is offline   Reply With Quote