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
- :
- Re: Help setting a property from a custom dialog (Installscript MSI)
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 18, 2007
03:45 AM
Help setting a property from a custom dialog (Installscript MSI)
Hi there,
I've created a custom dialog which all seems to work as expected however i've now hit a bit of wall.
What I want to do is take the values the user enters into an edit box and sets a property equal to the value entered. Am I right in thinking that this should be done using MsiSetProperty?
I've attached the code im using for the custom dialog, any help would be greatly appreciated.
Cheers,
Alan
I've created a custom dialog which all seems to work as expected however i've now hit a bit of wall.
What I want to do is take the values the user enters into an edit box and sets a property equal to the value entered. Am I right in thinking that this should be done using MsiSetProperty?
I've attached the code im using for the custom dialog, any help would be greatly appreciated.
Cheers,
Alan
#define EDIT1 1309
#define EDIT2 1310
prototype NUMBER CustomDialog();
function NUMBER CustomDialog()
NUMBER nReturn, nCtrl;
BOOL bDone;
STRING svEdit1, svEdit2;
begin
EzDefineDialog(
"Custom",
ISUSER,
"Custom",
NULL);
// call waitondialog until an event occurs.
while (!bDone)
//wait for interaction with a control
nCtrl = WaitOnDialog("Custom");
//switch statements handles the various controls on the dialog
switch (nCtrl)
case SD_PBUT_OK:
//next button clicked
CtrlGetText ("Custom", EDIT1, svEdit1);
CtrlGetText ("Custom", EDIT2, svEdit2);
nReturn = SD_PBUT_OK;
bDone = TRUE;
case SD_PBUT_BACK:
//back button clicked
nReturn = SD_PBUT_BACK;
bDone = TRUE;
case SD_PBUT_CANCEL:
//cancel button clicked
Do(EXIT);
bDone = TRUE;
endswitch;
endwhile;
EndDialog("Custom");
ReleaseDialog("Custom");
if nCtrl = SD_PBUT_OK then
//Just a test....
MessageBox (svEdit1 + "\n" + svEdit2, INFORMATION);
//If dialog closed with next button, set installer properties based on user responses.
MsiSetProperty(hMSI, "PropertyName1", svEdit1);
MsiSetProperty(hMSI, "PropertyName2", svEdit2);
endif;
return nReturn;
end;
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 18, 2007
10:45 AM
The calls to MsiSetProperty look reasonable, except the properties should probably be public (all upper-case) I don't know where your hMSI is coming from. In general, however, rather than directly changing properties as part of the dialog code, the suggested InstallScript style tends to favor returning the values in byref parameters, and allowing the code that invoked the dialog to store the properties. This is more flexible, but arguably more work at each call site.
This would look something like the following in e.g. OnFirstUIBefore (pardon any syntax errors):
This would look something like the following in e.g. OnFirstUIBefore (pardon any syntax errors):
Dlg_Mine:
nResult = MyDialogHere(szTitle, szMsg, szRet1, szRet2);
if (nResult = BACK) goto Dlg_Prev;
endif;
MsiSetProperty(ISMSI_HANDLE, "PROP1", szRet1);
MsiSetProperty(ISMSI_HANDLE, "PROP2", szRet2);
Dlg_Next:
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 18, 2007
11:51 AM
What's the actual issue you're encountering? The code by itself looks ok, but I'm just kinda wondering what you're getting at.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 19, 2007
05:48 AM
The problem I was encountering was that the project would not build due to me using hMSI (I'm not too sure where I got this from either...) rather than using ISMSI_HANDLE in the call to MsiSetProperty.
Thanks for the general advice about changing properties, I shall move the code to change properties out of the code for the dialog box.
For the time being I have changed my code within the dialog and the properties are being set as expected, thanks very much! 🙂
Thanks for the general advice about changing properties, I shall move the code to change properties out of the code for the dialog box.
For the time being I have changed my code within the dialog and the properties are being set as expected, thanks very much! 🙂