elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

call NewDialog from custom action

Hello

Is there any way to call (show) some dialog from custom action? I mean exact dialog which is in Dialog Table.
In msdn is written this:
If the name is not recognized by the installer as a built-in action or as a custom action in the CustomAction table, the name is passed to the user-interface handler object, which can invoke a function or a dialog box.
I would like to achieve this. But I don't know what parameter should I enter for szAction. I tried it with dialog name but it didn't work.

thanks.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: call NewDialog from custom action

Hi,

Can you tell us what exactly are you trying to do? Dialogs can be conditionally displayed and using published events,
in the Dialogs page.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: call NewDialog from custom action

Hi

I'm trying to do something what is not simple. I know how to use dialog and condition in common way in published events.
My installer is growing and now is too complicated. So if I could call NewDialog from custom action it would help me.

For example try imagine this.
If I could call NewDialog from CA than I could remember called dialog and put it on some stack. And if user press "Back" than I just pop dialog name from this stack and call it. Because in my installer exist many ways how to advance. And than I have always big problem how to set condition for next and back.
It is just one example. But what I am trying to do is call NewDialog from inside of custom action. In msdn is written something which gave my some hope that it is possible but I couldn't achieve it.

thanks.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: call NewDialog from custom action

Hello,

I'm not sure why you would need this, even in a complex installer. We advise against this behavior, which is why Advanced Installer does not directly support it.
Nonetheless, here is what can be done do achieve it. Since this is a workaround, thorough testing should be done before using it.

Attached is a sample project that implements this.
The Jump button's control event has been edited manually using the Table Editor, to set it's NewDialog event's target to a property instead of a fixed value (from the ControlEvent table). By manipulating that property, you effectively change the Dialog the Jump button jumps to.
You can change the property from within your custom action using MsiSetProperty win32 API.

Best regards,
Gabriel
Attachments
selectable.zip
(438.09 KiB) Downloaded 723 times
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: call NewDialog from custom action

Hi

Yes this is exactly what I mentioned here http://www.advancedinstaller.com/forums ... =1&t=10682
And it is solution which I can use at the end. But I was looking for something maybe little bit "nicer" :)

I would like to know what msdn means with sentence that if MsiDoAction don't recognize action from CustomAction table than it will pass it to user-interface handler object which can invoke dialog.
I know this is question for MSI developers but I don't know about any forum where I can ask them.

thanks for your advice.

btw. your example selection missing dialogs from repository so I must create it manually and put it into right place.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: call NewDialog from custom action

Hi,

Sorry about the bad attachment, here is the fixed one.

Regards,
Gabriel
Attachments
selectable.zip
(442.62 KiB) Downloaded 493 times
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
dblanchette
Posts: 4
Joined: Thu Mar 13, 2014 2:28 pm

Re: call NewDialog from custom action

Hi,

I have the same need and attempted the solution.

The problem is that it does not work with Enhanced User Interface. When I run the install kit with Enhanced UI and click on the Next button for which I modified the target in the table editor, the installer crashes. I get the following Warning in the windows Event Viewer :
Source : MsiInstaller
Description :
Failed to connect to server. Error: 0x800401F0.
The error code translates to
CoInitialize has not been called.
I also get the following Error :
Source : Application Error
Description :
Faulting application name: MySetup.exe, version: 1.0.0.0, time stamp: 0x53ea16e7
Faulting module name: MySetup.exe, version: 1.0.0.0, time stamp: 0x53ea16e7
Exception code: 0xc0000417
Fault offset: 0x000c5d81
Faulting process id: 0x1c58
Faulting application start time: 0x01cfbcbc95f79c46
Faulting application path: C:\Users\MyUser\AppData\Local\Temp\MySetup.exe
Faulting module path: C:\Users\MyUser\AppData\Local\Temp\MySetup.exe
Report Id: d7d2e0be-28af-11e4-8190-180373336ed8
Is there a way for this to work with Enhanced UI?

To explain my need, I have several dialogs that follows each other each depending on a feature or another being installed. I want the dialogs to follow correctly without ever needing to code all the conditions in each dialog (Example for dialogs A, B, C and D I would have to tell the Next button on A to display B if feature B is installed, C if feature C is installed, etc.) Conditions can change over time and dialogs can be added or removed so this is impratical I tried the "Show Only If..." Options on dialogs but they soon got messed up.

My solution is to use a C# Custom Action to compute the next dialog on pressing the Next button and populate a property that is then referenced in the ControlEvent Table. My custom action works, so if the ControlEvent table edition could work with Enhanced UI I would be good to go!

Thank you for your help.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: call NewDialog from custom action

Hello,

I'm afraid this workaround is not supported by our "Enhanced User Interface" feature. We'll try to add an improvement in a future version of Advanced Installer so that your can edit with a formatted reference the "Argument" field of our "Edit Control Event" dialog. We'll update this thread when the improvement will be available.

Until then, as a workaround, in order to achieve what you want you can add on [Next>] button as many "Display a specific dialog" published events as conditionally dialogs you have, and for every "Display a specific dialog" published event use a condition based on your property value (set within your custom action).

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dblanchette
Posts: 4
Joined: Thu Mar 13, 2014 2:28 pm

Re: call NewDialog from custom action

This seems like a good workaround for now. I look forward to be able to use Properties in Edit Control Event in the future.

Thank you
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: call NewDialog from custom action

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”