cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
polatchekm
Pilgrim

What do these parameters mean?

I'm trying to use createfile() in a user function. The documentaton has the following snippet:

#define EXAMPLE_DIR "C:\\"
#define EXAMPLE_FILE "ISExampl.txt"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype ExFn_CreateFile(HWND);

function ExFn_CreateFile(hMSI)
STRING szTitle, szMsg;
NUMBER nvFileHandle;
begin
// Set the file mode to append.
OpenFileMode (FILE_MODE_APPEND);

What do the parameters HWND and hMSI represent?

This will be my first user function in IS.

Thanks,
Mel Polatchek
Labels (1)
Tags (1)
0 Kudos
3 Replies
phill_mn
Pilgrim

Re: What do these parameters mean?

This example code is for an InstallScript MSI Custom Action. Is that what you are trying to create?

All MSI Custom Actions have an entry point function which has a single argument typically named "hMSI" which is a handle to the MSI install instance that the Custom Action is running in. In InstallScript code a Windows handle is declared as type HWND.
0 Kudos
polatchekm
Pilgrim

This is an Installscript project

This is a modification to an existing Installscript project. The documentation does not say MSI only, I am assuming I can make it work within Installscript as a User Def Function. Thanks for the tip about the handle.
0 Kudos
phill_mn
Pilgrim

Re: What do these parameters mean?

The example code where that snippet came from does indicate that it should be used in a MSI custom action.
"Note To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release."

http://kb.flexerasoftware.com/doc/Helpnet/installshield15langref/LangrefCreateFile_Example.htm

I would agree that the above note does not make it clear that the code will not work, as is, in anything other than a MSI custom action, but that is implied.

If your function is not being called in the context of a custom action, then change the function prototype to reflect that there would not be a MSI handle.

#define EXAMPLE_DIR "C:\\"
#define EXAMPLE_FILE "ISExampl.txt"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype My_CreateFile();

function My_CreateFile()
STRING szTitle, szMsg;
NUMBER nvFileHandle;
begin
// Set the file mode to append.
OpenFileMode (FILE_MODE_APPEND);

.....
0 Kudos