cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jonathanqis
Level 6

Simple Custom action in merge module errors

😞 Am I missing a step ?

I have created a merge module and an Installscript MSI project to call into it.

In the merge module I created a custom action:

As a 'New Installscript' typed one, which calls a script function which invokes a dialog as below.
N.B. The dialog is a custom one created in the merge module.

export prototype ShowDialog(HWND);

[HTML]function ShowDialog(hInst)
begin
MessageBox( "SetProp being called", INFORMATION );
MsiSetProperty(hInst,"TESTPROP", "25");
end;

function PLSetup(hInst)
HWND hwndDlg;
STRING szDlg;
NUMBER nCtrl;
BOOL bDone;
LIST listLogging;
STRING svRestartAttempts;
NUMBER nResult;
begin
szDlg = "PLSetup";

if(!bSdInit) then
SdInit();
endif;

if (EzDefineDialog( szDlg, "", "", 1000) = DLG_ERR) then
return -1;
endif;

bDone = FALSE;
while (!bDone)
nCtrl = WaitOnDialog(szDlg);
MessageBox( "WaitOnDialog been called", INFORMATION );

switch (nCtrl)
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
hwndDlg = CmdGetHwndDlg(szDlg);
SdGeneralInit(szDlg, hwndDlg, 0, "");

case DLG_CLOSE:
SdCloseDlg( hwndDlg, nCtrl, bDone );
default:
if (SdIsStdButton(nCtrl) && SdDoStdButton(nCtrl)) then
bDone = TRUE;
endif;
endswitch;
endwhile;

EndDialog(szDlg);
ReleaseDialog(szDlg);
SdUnInit();
return nCtrl;
end;
[/HTML]

However, the WaitOnDialog call returns a -1 (DLG_ERR)

Does anyone have any idea why this call fails ?

This is a key mechanism I need to get working or find an alternative.

Does anyone see a problem with doing this ?
Labels (1)
0 Kudos
(2) Replies
jonathanqis
Level 6

This must I feel be a resources issue as I have now managed to use the exact same mechanism to call source code (in the merge module) for the sdWelcome dialog.
The dialog displays and completes without fault.

I placed this code in the merge module scripts and invoked through an identical custom action being called from the main project.

[HTML]function JHSdWelcome(hInst)
string szDlg, szTemp;
number nId, nMessage, nTemp, nSdDialog;
HWND hwndDlg;
BOOL bDone;
string szTitle;
string szMsg;
begin
szTitle = "Title";
szMsg = "Message";
szDlg = SD_DLG_WELCOME;
nSdDialog = SD_NDLG_WELCOME;

if(!bSdInit) then
SdInit();
endif;

if(EzDefineDialog( szDlg, "", "", SD_NDLG_WELCOME ) = DLG_ERR) then
return -1;
endif;
bDone = FALSE;

while (!bDone)
nId = WaitOnDialog( szDlg );
switch(nId)
case DLG_INIT:
if( szMsg != "" ) then
SdSetStatic(szDlg, SD_STA_MSG, szMsg);
endif;
hwndDlg = CmdGetHwndDlg( szDlg );
SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
SdSetDlgTitle(szDlg, hwndDlg, szTitle);
case NEXT:
nId = NEXT;
bDone = TRUE;
case BACK:
nId = BACK;
bDone = TRUE;
case DLG_ERR:
SdError( -1, "SdWelcome" );
nId = -1;
bDone = TRUE;
case DLG_CLOSE:
SdCloseDlg( hwndDlg, nId, bDone );
default:
if(SdIsStdButton( nId ) && SdDoStdButton( nId )) then
bDone = TRUE;
endif;

endswitch;

endwhile;

// Cleanup Dialog
EndDialog( szDlg );
ReleaseDialog( szDlg );
SdUnInit();
end;[/HTML]
0 Kudos
jonathanqis
Level 6

:mad: Please help, this one is driving me mad.

I have now tried just about every possible combination of parameteres to the EzDefineDialog and WaitOnDialog functions including trying DefineDialog.
But I can get nothin but -1 back from the WaitOnDialog.

This seems like a very popular scenario where an install has functionality for a feature encapsulated within a merge module and it can all be accessed from the main project.

I am quite simply trying to invoke a custom dialog, implemented in the merge module, by calling a merge module custom action from the main project.
No dodgy background hacks of tables or extra dlls or third party fixes.
This should be boiler plate stuff and a detailed help article demonstrating it.

So if anyone can spot the obvious or has any suggestions I am all ears.
0 Kudos