View Single Post
Old 27th April 2019, 21:12   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,178
Try this new plug-in.

with this code

PHP Code:
Unicode True
RequestExecutionLevel User
XPStyle On 
SysLink
PESubsysVer 5.1 
SysLink is XP+
BrandingText ""
Name "WndEvent test"
Caption "$(^Name)"
SubCaption 4 " "
Section
SectionEnd
Page InstFiles 
"" OnInstFilesShow
!include nsDialogs.nsh


Function OnInstFilesShow
FindWindow 
$"#32770" "" $hWndParent
StrCpy 
$""
loopFindWindow $"" "" $$0
ShowWindow 
$0 0 Hide controls we don't care about
IntPtrCmpU 0 $0 "" loop loop

WndEvent::CreateWindow "SysLink" '
Hello <A HREF="http://example.com">World</A>' ${WS_CHILD}|${WS_VISIBLE} ${WS_EX_TRANSPARENT} 0u 0u 100u 12u "PAGE"
Var /Global syslink
Pop $syslink
GetFunctionAddress $1 SysLinkHandler
WndEvent::AddHandler "NOTIFY" "$syslink>PARENT" $1

WndEvent::CreateWindow "SysLink" '
<A HREF="http://example.net">Link2</A>' ${WS_CHILD}|${WS_VISIBLE} 0 65u 145u 100u 12u $hWndParent
Var /Global syslink2
Pop $syslink2
GetFunctionAddress $1 SysLinkHandler
WndEvent::AddHandler "NOTIFY" "$hWndParent" $1
FunctionEnd

!define /IfNDef NM_CLICK -2
!define /IfNDef NM_RETURN -4
Function SysLinkHandler
${If} $2 = ${NM_CLICK}
${OrIf} $2 = ${NM_RETURN}
    ${If} $syslink Z= $3
    ${OrIf} $syslink2 Z= $3
        ExecShell "" "http://example.com"
    ${EndIf}
${EndIf}
FunctionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote