mcuser
Posts: 13
Joined: Mon Jan 17, 2011 9:30 pm

"Call Function From Stardard DLL" in UI sequence

Sun Jan 23, 2011 6:37 pm

Hi,

I would like to be able to make several different calls to a DLL while in the UI sequence. The DLL methods have parameters so, according to my understanding, I am required to use "Call Function From Standard DLL" which is not available as "UI Custom Actions". I have tried playing around with InstallUISequence custom actions, but I cannot trigger the action on a particular (custom) dialog.

Any suggestion?

Also, if I add the DLL as a "Temporary File", will I be able to use it in the UI Sequence?

Thank you.

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

Re: "Call Function From Stardard DLL" in UI sequence

Mon Jan 24, 2011 1:05 pm

Hello,

You can easily pass data to your UI custom action through the CustomActionData property. On the UI Sequence, before calling your custom action using the DoAction event, simply use a SetProperty published event to set the CustomActionData property with the information you wish to pass to your custom action. You can then access the data stored in this property from within your custom action by using the ::MsiGetProperty API.

Let me know how this works for you.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

mcuser
Posts: 13
Joined: Mon Jan 17, 2011 9:30 pm

Re: "Call Function From Stardard DLL" in UI sequence

Mon Jan 24, 2011 2:30 pm

Hi,

Thank you for your answer. Indeed that would be the simplest solution... but right now, I cannot edit the dll (unless there is no other way around it).

The "Call Function From Standard DLL" utility would have been perfect for my situation as it allows passing parameters to methods of my dll and handling different types of returned values. I would then be able to use the "twin forms" model to make a dynamic updates of fields according to returned values.

Any workaround for this (not involving updating dll)?

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

Re: "Call Function From Stardard DLL" in UI sequence

Tue Jan 25, 2011 12:06 pm

Hello,

An alternative solution would be:
- under UI Custom Actions, add a new attached custom action, and select "<AI_CUSTACTS>stdDllWrapper.dll" as the dll, where <AI_CUSTACTS> is the path variable containing the path to the folder in which stdDllWrapper.dll resides
- add the custom action where you need your dll to run
- add a new SetProperty event before the stdDllWrapper custom action, and ,using it, set the CustomActionData property to the string that holds the parameters for the stdDllWrapper custom action.
You can find out that string by adding a Call Function from Standard DLL under InstallExecuteSequence, configuring the parameters you need, then copying the string to your SetProperty event. For reference, the string should look something like "[FolderProp]file.dll?V;;S;YourFunction;", depending on what parameters you've set for the Call Function from Standard DLL custom action. Then, delete the custom action you've just created under InstallExecuteSequence, you only needed it to find out the generated string holding its configuration.
- make sure the SetProperty published event runs before the stdDllWrapper custom action you've set on the ui.
That's it. Now, stdDllWrapper.dll should call your custom action.

Let me know if you encounter difficulties implementing this.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”