Tuesday, December 18, 2012

Writing custom strings to MSI Log File

Its a general practise to create a log file for troubleshooting installation related issues. By default installshield writes log file but it does not contain the logs related to our own created custom actions. We could write our own strings to the msi file by using SprintfMsiLog. 

For this we need to declare the prototype and defintion of our installscript code as below:

Custom action name: LoggingCustomAction

Code:
#include "ifx.h"
//prototype
export prototype LoggingCustomAction(HWND);

//custom action definition
function LoggingCustomAction(hLogInstall)
begin
    SprintfMsiLog("Writing Custom Log...");
    //return success to MSI
    return ERROR_SUCCESS;
end;


In order to be called, the custom action must be scheduled in the sequences. For this example, open the Custom Actions view and create an immediate-mode InstallScript custom action called callLoggingTest that calls the LoggingTestInstallScript function, and schedule it to run after LaunchConditions.

After building the package and running it with the /L*v switch, you should see a line similar to the following in the log file:
InstallShield 25:00:00: Invoking script function LoggingTestInstallScript
1: Calling LoggingTestInstallScript...

Wednesday, June 20, 2012

Change text in the Title bar of Installshield dialogs

IFX_SETUP_TITLE

This system variable contians the value to be displayed in the title bar of all the built-in dialogs (except dialogs generated directly by Windows API function calls) and all message boxes generated by the MessageBox function.

This system variable is automatically initialized to the value of the string entry TITLE_CAPTIONBAR, if that entry exists; if that entry does not exist, IFX_SETUP_TITLE is initialized with the following internal code:

Sprintf( IFX_SETUP_TITLE, SdLoadString( IDS_IFX_FORMAT_SETUP_TITLE ), IFX_PRODUCT_DISPLAY_NAME );

Changing the value of IFX_SETUP_TITLE automatically resets the title of all dialogs displayed by the setup.

Monday, May 28, 2012

Stop running processes

Hi,
Below is the code I had developed in C# for stopping the running processes on a user machine. This will be helpful while installing certain custom applications from installer.

 Process[] myProcesses;
// Returns array containing all instances of Notepad.
myProcesses = Process.GetProcessesByName("Notepad");
foreach(Process myProcess in myProcesses){
    myProcess.CloseMainWindow();