Archive: Adding a button during the install process


Adding a button during the install process
Hey guys... I've searched the forums and NSIS wiki here and haven't been able to come up with an answer on this one, so hopefully a NSIS stud can help me out!

I'd like to add a button (a bitmap button to be specific) on the installing components screen (the MUI_PAGE_INSTFILES page). The goal is to have a button with an image saying something to the effect of "click here to go to our site and learn more" while the user is waiting for the installation to complete.

So although a InstallOptions::dialog approach can work using a custom page, it really it's a poor solution since users will blow right past it to get on with the installation process. The INSTFILES page is the perfect place to communicate with users since they're waiting for the installer to do its thing.

So far, I've tried editing the resource in modern.exe (adding a bitmap button), but the problem is that I need a way for NSIS to callback when that button is pressed. Where is the code that dispatches a button press to the action? I wasn't able to find a InstallOptions::dialog style call in MUI, so it's not even clear how I can catch my custom button press.

I've burned a ton of time trying to crack this one, so an elegant solution would be REALLY appreciated! Thanks in advance!!


You can add a standard button and use the ButtonEvent plug-in on it to open your site with ExecShell.

Stu


Excellent, Stu -- that seems to be perfect!

Hrm, the only remaining puzzle is that all my attempts to set the button image aren't working. I'm using BS_BITMAP and then using the code:

FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 2000
System::Call '${sysLoadImage} (0, s, ${IMAGE_BITMAP}, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r6' "$1"
SendMessage $0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $6
System::Call "${sysDeleteObject} (r6)"

Think there's ay way to make this image trick work? Thanks in advance, stu!



Originally posted by Afrow UK
You can add a standard button and use the ButtonEvent plug-in on it to open your site with ExecShell.

Stu

Just to ensure there are no errors in that code, you could use the NSD_SetImage and NSD_FreeImage macros as described in the nsDialogs documentation.

Setting an image like this will not properly skin the button IIRC.

Stu


Interesting... The issue with nsDialogs is that it doesn't seem to work with the NSIS standard INSTFILES page (in that nsDialogs assumes you want to make the page from scratch). Is there are a way to have nsDialogs add to the existing/current dialog? Otherwise, I'm not seeing the way one can use nsDialogs with an existing dialog (and it seems like it'd be a lot of work to implement the existing INSTFILES page using nsDialogs since it's tied to innate NSIS functionality).

Meanwhile, using BM_SETIMAGE instead of STM_SETIMAGE in that above code seems to cause the image to update inconsistently (sometimes it doesn't appear--it seems to depend on if the image gets obscured and needs to get refreshed). I know you mentioned this wasn't the way to go, but without a way to use nsDialogs in combination with the existing MUI_PAGE_INSTFILES, I'm not sure how to proceed.

Thanks again for you help, Stu -- I'll owe ya one if we can get this!


Try destroying your bitmap in .onGUIEnd instead.

Stu


Hah, that was it -- that image needs to stick around.

Very much thanks for your help, Stu! Very kind of you, and have a great holidays!

Cheers,
Andy