smljoju
Posts: 37
Joined: Fri Jun 27, 2014 1:36 pm

Get message box result for deferred custom action

Thu Jul 15, 2021 3:14 pm

Scenario is that we need to do some migration of files during installation and possibly show message box if some error occurs.

Issue is that we should do migration during system modification so we set custom action as deferred, and so message box custom action also need to be deferred, but issue is that how can we get message box result when we're running it deferred? because we cannot set installer property on deferred custom action.

We can show message box on the custom action code itself, this runs separate exe for migration, but issue is that message box will not be modal against the installer UI so it shows on top of the installer dialog but can go behind it

Please advise on how to proceed

smljoju
Posts: 37
Joined: Fri Jun 27, 2014 1:36 pm

Re: Get message box result for deferred custom action

Mon Jul 19, 2021 9:18 am

up! any suggestions?

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: Get message box result for deferred custom action

Mon Jul 19, 2021 5:40 pm

Hello,

It is indeed true that you can not set an installer property during the deferred stage - you can only retrieve the value of a property (that was set during the immediate stage) through the CustomActionData special property.

In this case, the only solution would probably be the one you have presented - i.e. to handle the return code and spawn the messagebox from the same custom action.

I can not really think of any other solution, as it would most likely involve setting an installer property.

Please let me know if there is anything else I could help you with and I will gladly assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

smljoju
Posts: 37
Joined: Fri Jun 27, 2014 1:36 pm

Re: Get message box result for deferred custom action

Mon Jul 19, 2021 6:05 pm

ok right now I'm showing the message box from the separate exe, which probably cannot be modal to the installer dialog because they're different processes

but if I do a custom action DLL which spawns the separate exe then handle exit code in the custom action DLL then show message box from the DLL code, will it be modal to the installer dialog?

smljoju
Posts: 37
Joined: Fri Jun 27, 2014 1:36 pm

Re: Get message box result for deferred custom action

Mon Jul 19, 2021 6:25 pm

ok I see that it is not modal, I think I need to get the window object of the installer dialog so I can set it as owner of the message box I'm showing, any way to do that?

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: Get message box result for deferred custom action

Tue Jul 20, 2021 3:53 pm

Hello,

By "modal to the installer dialog", do you mean having the same theme?

If that is the case, I am not quite sure that can be done from within a custom action.

Recently, my colleague Dan has written an article about making the messagebox (displayed by a launch condition) have the same theme as your installer and it involves using an empty dialog as a messagebox, meaning that even our predefined custom action can not be displayed in the installer's theme. If you need more information about this, please have a look over the following article:

Display themed dialog instead of standard Launch Condition dialog

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

smljoju
Posts: 37
Joined: Fri Jun 27, 2014 1:36 pm

Re: Get message box result for deferred custom action

Wed Jul 21, 2021 7:48 am

Hello,

By modal I mean that it doesn't go behind the installer dialog, so when you click the installer dialog the message box will stay on top of the installer dialog.

I think only way to do that is if I can get a IWin32Window reference to the installer dialog or get its window handle, any way to do that?

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: Get message box result for deferred custom action

Wed Jul 21, 2021 4:28 pm

Hello,

Thank you for your followup on this - I now understand what you meant by "modal dialog".

To be fully honest with you, I am not quite sure how that can be achieved.

Perhaps this StackOverflow thread may help:

C# / .NET messagebox is not modal

although this has been asked 12 years ago and I am not sure this is still of actuality.

Please let me know if there is anything else I could help you with and I will gladly do so.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”

 

 

cron