This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Run IS in DEBUG mode
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Jan 30, 2012
04:34 PM
OnBegin doesn't execute
Hi,
I"m using Installshield 12 demo version.
When I run my test project the OnBegin event doesn't execute.
Below is my source code in setup.rul
Any help will be much appreciated.
Thanks
GJ
////////////////////////////////////////////////////////////////////////////////
//
// This template script provides the code necessary to build an entry-point
// function to be called in an InstallScript custom action.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
////////////////////////////////////////////////////////////////////////////////
// Include Ifx.h for built-in InstallScript function prototypes, for Windows
// Installer API function prototypes and constants, and to declare code for
// the OnBegin and OnEnd events.
#include "ifx.h"
#include "iswi.h"
// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
export prototype MyFunction(HWND);
// To Do: Declare global variables, define constants, and prototype user-
// defined and DLL functions here.
// To Do: Create a custom action for this entry-point function:
// 1. Right-click on "Custom Actions" in the Sequences/Actions view.
// 2. Select "Custom Action Wizard" from the context menu.
// 3. Proceed through the wizard and give the custom action a unique name.
// 4. Select "Run InstallScript code" for the custom action type, and in
// the next panel select "MyFunction" (or the new name of the entry-
// point function) for the source.
// 5. Click Next, accepting the default selections until the wizard
// creates the custom action.
//
// Once you have made a custom action, you must execute it in your setup by
// inserting it into a sequence or making it the result of a dialog's
// control event.
///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows(TM) Installer executes your custom action (see the "To
// Do," above).
//
///////////////////////////////////////////////////////////////////////////////
function MyFunction(hMSI)
// To Do: Declare local variables.
begin
// To Do: Write script that will be executed when MyFunction is called.
end;
function OnBegin( )
STRING nResult;
begin
if (GetDisk("f",nResult) < 0) then
MessageBox("No f: drive detected, exiting installation",SEVERE);
ExitInstall();
endif;
end;
I"m using Installshield 12 demo version.
When I run my test project the OnBegin event doesn't execute.
Below is my source code in setup.rul
Any help will be much appreciated.
Thanks
GJ
////////////////////////////////////////////////////////////////////////////////
//
// This template script provides the code necessary to build an entry-point
// function to be called in an InstallScript custom action.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
////////////////////////////////////////////////////////////////////////////////
// Include Ifx.h for built-in InstallScript function prototypes, for Windows
// Installer API function prototypes and constants, and to declare code for
// the OnBegin and OnEnd events.
#include "ifx.h"
#include "iswi.h"
// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
export prototype MyFunction(HWND);
// To Do: Declare global variables, define constants, and prototype user-
// defined and DLL functions here.
// To Do: Create a custom action for this entry-point function:
// 1. Right-click on "Custom Actions" in the Sequences/Actions view.
// 2. Select "Custom Action Wizard" from the context menu.
// 3. Proceed through the wizard and give the custom action a unique name.
// 4. Select "Run InstallScript code" for the custom action type, and in
// the next panel select "MyFunction" (or the new name of the entry-
// point function) for the source.
// 5. Click Next, accepting the default selections until the wizard
// creates the custom action.
//
// Once you have made a custom action, you must execute it in your setup by
// inserting it into a sequence or making it the result of a dialog's
// control event.
///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows(TM) Installer executes your custom action (see the "To
// Do," above).
//
///////////////////////////////////////////////////////////////////////////////
function MyFunction(hMSI)
// To Do: Declare local variables.
begin
// To Do: Write script that will be executed when MyFunction is called.
end;
function OnBegin( )
STRING nResult;
begin
if (GetDisk("f",nResult) < 0) then
MessageBox("No f: drive detected, exiting installation",SEVERE);
ExitInstall();
endif;
end;
(8) Replies
‎Feb 01, 2012
08:49 AM
gigolojoe wrote:
Hi,
I"m using Installshield 12 demo version.
When I run my test project the OnBegin event doesn't execute.
Below is my source code in setup.rul
Any help will be much appreciated.
Thanks
GJ
Can you try running it in DEBUG mode and step thru' the code?
‎Feb 01, 2012
09:33 AM
Hi Tampaite,
I tried running in debug mode but wasn't able to step through the code.
Does it matter that I am using an msi project instead of an installscript project?
I tried using an install script project and installscript\msi project and neither would run my code.
Does the demo version have that feature disabled?
Thanks
I tried running in debug mode but wasn't able to step through the code.
Does it matter that I am using an msi project instead of an installscript project?
I tried using an install script project and installscript\msi project and neither would run my code.
Does the demo version have that feature disabled?
Thanks
‎Feb 01, 2012
12:10 PM
gigolojoe wrote:
Hi Tampaite,
Does it matter that I am using an msi project instead of an installscript project?
Does the demo version have that feature disabled?
Thanks
It shouldn't matter which project you create. Evaluation version doesn't have DEBUG disabled(I just downloaded a copy and verified it).
Can you just add the below simple messagebox and see if you can step into it?
MessageBox("Hello World", INFORMATION);
‎Feb 01, 2012
04:12 PM
InstallScript events (such as OnBegin) are supported only by InstallScript and InstallScript MSI projects. To run InstallScript code in a Basic MSI project, an InstallScript custom action needs to be created and sequenced where/when you would like the code to run. In addition, the custom action function needs to be defined and exported in the setup.rul (see the MyFunction prototype and implementation in the original post).
If you would like to use an event driven script, an InstallScript project is the recommended project type.
If you would like to use an event driven script, an InstallScript project is the recommended project type.
‎Feb 01, 2012
05:36 PM
One other thing to note, and this may not matter if the code the post has in OnBegin is just some test code, but the GetDisk function is used to return the drive portion of a path passed to it. For example, GetDisk will return 'C:' if the path 'C:\Program Files\Test' was passed (the function return value is successful if a drive could be parsed out of the path, failure otherwise). To determine if a drive is present on a machine, use the ExistsDisk function instead which returns EXISTS (0) if the drive is present and NOTEXISTS (-1) if it isn't.