kiv
Posts: 12
Joined: Sat May 20, 2006 4:09 pm

Passing parameters to a DLL function

I am creating a custom action in which I want to call a function from a DLL I am creating. I want to pass some parameters to it, like destination folder. I can edit the custom action prarameters, but can't figure out the parameter types in the DLL function.

Any help will be greatly appreciated.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

DLL functions used as custom action must have the following signature:

Code: Select all

UINT __stdcall MyCustomAction(MSIHANDLE hInstall)
The MSIHANDLE is passed as an argument to the DLL Custom Action function. Also you need to export the function using a module-definition (.DEF) file. To take the value of a property in the DLL function use MsiGetProperty function:

Code: Select all

UINT res = ::MsiGetProperty(hInstall, _T("APPDIR"), szValue, &dwLen);
We have an example on how to use session properties in DLL function in the AI online documentation, please follow this link: http://www.advancedinstaller.com/user-g ... n-dll.html

Regards,
Gigi
____________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
kiv
Posts: 12
Joined: Sat May 20, 2006 4:09 pm

Thanks, this was all I was looking for.
Keep up the good work with this wonderfull product :)

Return to “Common Problems”