Sample Code to Call InstallStatusMIF

You must include code in your setup application that calls InstallStatusMIF. Note that your setup application should create one and only one package command status MIF file.

An example of the required setup code is shown below. This example loads the appropriate library (ISMIF32.DLL or ISMIF16.DLL), retrieves the address of the InstallStatusMIF function, and then calls the function, passing the parameters for the application being installed or removed. The code also reports whether the MIF file was created and, if not, the reason for the failure.

If successful, this code sample results in a package command status MIF file called OFFICE97.MIF in the Windows directory.

{
HINSTANCE hInstLibrary;
DWORD (WINAPI *InstallStatusMIF)(char*, char*, char*, char*, 
        char*, char*, char*, BOOL);

#ifdef WIN32
   if (hInstLibrary = LoadLibrary("ismif32.dll"))
#elif defined WIN16
   if (hInstLibrary = LoadLibrary("ismif16.dll"))
#endif
 {
   InstallStatusMIF = (DWORD (WINAPI *)(char*,char*,char*, 
         char*,char*,char*,char*,BOOL))GetProcAddress(hInstLibrary, 
         "InstallStatusMIF");
if (InstallStatusMIF)
{
        if (InstallStatusMIF("office97", "Microsoft", "Office 97", 
           "999.999", "ENU", "1234","Completed successfully",
           TRUE) !=0)
{
    MessageBox("File is in your windows directory\Operation 
                      successful");
}
else
{
    MessageBox("Write to MIF file failed");
}
}
else
{
MessageBox("Failed to get procedure address from DLL");
}
FreeLibrary(hInstLibrary);
}
else
{
MessageBox("Load of DLL failed");
}
}
 

See Sample Package Command Status MIF File for an example of the resulting MIF file.