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: Problem reading a property, immediately after setting
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
Oct 03, 2012
10:05 AM
Problem reading a property, immediately after setting
Hello,
I have a snippet of code similar to the following:
If I enter "Hello" in the CONTROL_NAME (which is an edit field). I see a message box that displays "Hello", followed by one that says "test".
What's strange is that Myfunction is called by MyParentFuction, which in turn is called by MyGrandParentFunction. I have code similar to the following in MyGrandParentFunction:
And I see a messagebox that displays "Hello" there. It appears there might be a race condition or something like that going on, such that the property isn't set yet by the time I'm reading it in MyFunction().
At the end of the day, I need to read "MyProperty" in MyGrandParent, so this will work for me, but I'd like to understand why I can't seem to read the property in MyFunction().
-Eric
I have a snippet of code similar to the following:
#define PROP_MY_PROPERTY "MyProperty"
function NUMBER MyFunction()
STRING strThisProperty;
STRING strThisPropertyProp;
begin
nSize = 256;
dialogName = "MyFunction";
nReturn = EzDefineDialog(dialogName, ISUSER, dialogName, 0);
if(nReturn = DLG_ERR) then
MessageBox("error on exDefineDialog MyFunction", INFORMATION);
endif;
bDone = FALSE;
while (!bDone)
nControl = WaitOnDialog(dialogName);
switch (nControl)
case MY_BUTTON_NEXT:
CtrlGetText(dialogName, CONTROL_NAME, strThisProperty); //Assign the control to the variable
MessageBox("In MyFunction.rul, strThisProperty = " + strThisProperty, INFORMATION);
strThisPropertyProp = "test";
MsiSetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisProperty); //Assign the variable to the property
MsiGetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisPropertyProp, nSize); //Assign the property to the variable
MessageBox("In MyFunction.rul, strThisPropertyProp = " + strThisPropertyProp, INFORMATION);
nReturn = MY_BUTTON_NEXT;
bDone = TRUE;
case DLG_INIT:
//Stuff that gets initialized
MsiGetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisProperty, nSize); //Assign the property to the variable
CtrlSetText(dialogName, CONTROL_NAME, strThisProperty); //Assign the variable to the control
// ...cases for other controls...
endswitch;
endwhile;
EndDialog(dialogName);
ReleaseDialog(dialogName);
return nReturn;
end;
If I enter "Hello" in the CONTROL_NAME (which is an edit field). I see a message box that displays "Hello", followed by one that says "test".
What's strange is that Myfunction is called by MyParentFuction, which in turn is called by MyGrandParentFunction. I have code similar to the following in MyGrandParentFunction:
MsiGetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisProperty, nSize); //Assign the property to the variable
MessageBox("In MyGrandparent.rul, strThisProperty = " + strThisProperty, INFORMATION);
And I see a messagebox that displays "Hello" there. It appears there might be a race condition or something like that going on, such that the property isn't set yet by the time I'm reading it in MyFunction().
At the end of the day, I need to read "MyProperty" in MyGrandParent, so this will work for me, but I'd like to understand why I can't seem to read the property in MyFunction().
-Eric
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 04, 2012
03:28 AM
Hello,
please regard this code:
nSize=255;
MsiGetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisProperty, nSize);
You have to set nSize to value > 0.
Regards
please regard this code:
nSize=255;
MsiGetProperty(ISMSI_HANDLE, PROP_MY_PROPERTY, strThisProperty, nSize);
You have to set nSize to value > 0.
Regards
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)