Skip to content
⌘ NSIS Forum Archive

BrandingText as URL

13 posts

Chris786#

BrandingText as URL

Is there a way to make the BrandingText a clickable link that will open up a website?
Afrow UK#
Not without a plugin or modifying the source.
It's an idea for a good plugin though. Perhaps I shall make it 🙂

-Stu
zeeh3#edited
You can try linker plugin

Function .onGUIInit
  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $HWNDPARENT 1028
  EnableWindow $0 1
  Linker::link /NOUNLOAD $0 "http://www.google.com/"
Functionend
Function .onGUIEnd
  Linker::unload
FunctionEnd 
nsnb#
In the first version (Linker plugin), what is the purpose of FindWindow (both in the example and the the documentation for this plugin)?
  FindWindow $0 "#32770" "" $HWNDPARENT 
I looked at both implementations and it seems that AfrowUK's doesn't require these extra lines (of FindWindow, HWND, etc.).

So, if functionality/features of both solutions is identical, why should I prefer Linker plugin over AfrowUK's solution?

Thanks.
Afrow UK#
Linker allows any static texts to be changed to a Url whereas mine is specifically for the branding static text.

Stu
nsnb#edited
Originally posted by Afrow UK
Linker allows any static texts to be changed to a Url whereas mine is specifically for the branding static text.
So, the FindWindow/HWND is for getting the id of the static text itself? Not the wizard window?

Updating, to explain what I am confused about: in Linker's example.nsi there is:
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1006 
Now, what do the hardcoded "#32770" and "1006" mean? AFAIK, it is not a good practice to hardcode windows IDs because they are not guaranteed to retain their values on all systems. Are "#32770" and "1006" NSIS documented values that are guaranteed to always mean the same thing? If so, what do they mean?

Thank you, Stu!
Afrow UK#
The control id 1006 will never change because it is hard coded in the executable resource in the Contrib\UIs folder.
The window class #32770 is not unique in windows but because $HWNDPARENT is used with FindWindow, then #32770 becomes unique (it is a child window of $HWNDPARENT).

Stu
nsnb#
Originally posted by Afrow UK
The control id 1006 will never change because it is hard coded in the executable resource in the Contrib\UIs folder.
The window class #32770 is not unique in windows but because $HWNDPARENT is used with FindWindow, then #32770 becomes unique (it is a child window of $HWNDPARENT).
OK, this is clear.

The problem now is that I am using MUI2, where I don't really use the 'page' statement but rather:
  !insertmacro MUI_PAGE_WELCOME 
Also, in MUI2 I can't use .onGUIInit as described in the example. I tried using:
  !define MUI_CUSTOMFUNCTION_GUIINIT myGUIInit 
but it doesn't work. The script compiles successfully, but I get a warning:
1 warning:
install function "myGUIInit" not referenced - zeroing code (585-595) out
Any idea what I am doing wrong?

I am going to workaround this by using your BrandingURL plugin, but it would be nice to understand what I failed to understand in the Linker's documentation.
nsnb#
Originally posted by nsnb
Any idea what I am doing wrong?
I just discovered what I was doing wrong:
  !define MUI_CUSTOMFUNCTION_GUIINIT myGUIInit 
should come BEFORE
 !insertmacro MUI_PAGE_WELCOME 
not after.

Now I need to find out why the Branding text disappears if I click it (it works and it invokes the browser when clicked, but after closing the browser there is no refresh for that particular control).
nsnb#
Originally posted by nsnb
Now I need to find out why the Branding text disappears if I click it (it works and it invokes the browser when clicked, but after closing the browser there is no refresh for that particular control).
I fixed that, too - by switching to Stu's BrandingURL plugin, instead of using the Linker plugin. 🙂

Stu's BrandingURL plugin refreshes the branding text after being clicked. The Linker plugin doesn't.