New DLL Custom Action Function Prototype

InstallShield 2019 Express Edition

The new function signature enables you to get a handle to the .msi database that is currently running. Once you have a handle to the database, you can call any number of Windows Installer APIs. The example below shows how to retrieve the value of the ProductName property.

UINT __stdcall Action(MSIHANDLE hInstall)

  {

    TCHAR buffer[32] = {0};

    DWORD dWord = 32;

    MsiGetProperty(hInstall, TEXT("ProductName"), buffer, &dWord);

    MessageBox(0,buffer,TEXT("Showing Product Name"), MB_OK);

    return 1;

  }

Your function should return a non-zero value to indicate that the action finished successfully and that the installation should continue. If your function returns the number 0 and you selected No for the custom action’s Ignore Exit Code setting, the installation exits. If you selected Yes for the custom action’s Ignore Exit Code setting, the installation continues, regardless of the custom action’s return code.

Requirements

Header: Declared in Msiquery.h
Library: Use Msi.lib

Both Msiquery.h and Msi.lib can be found in the Windows Installer SDK, which can be downloaded from Microsoft’s Web site. In addition to the two files listed above, the Windows Installer SDK contains Microsoft’s definitive documentation on the Windows Installer APIs.

See Also