Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

MessageBoxes to Background?


2 replies to this topic

cmahood

cmahood
  • Members
  • 28 posts

Posted 27 July 2004 - 18:56

I have some installscript Custom Actions called as result of DoAction linked to "next" button on a dialog. These custom actions are used to validate input to make sure it is in correct range.

If the text is out of range, the CA will display a message box. This works great in some of my dialogs, but in other dialogs, the Modal Message Box goes to the background the FIRST time it is displayed. Subsequent times it displays properly.

The dialogs are nearly identical as are the custom actions. I cannot explain why sometimes the dialog boxes go to the background. I think this may be a bug in IS Developer 7.

Any ideas?

Here is an example of the installscript:



#define MB_SETFOREGROUND 0x00010001
//////////////////////////////////////////////////////////////////////////////
//
// Function: ValidateNumWeeks
//
///////////////////////////////////////////////////////////////////////////////
function ValidateNumWeeks(hMSI)
// To Do: Declare local variables.
NUMBER strSize, nVar;
STRING svValue,szValue;
begin
//DB Server Name
MsiSetProperty (hMSI, "VALIDNUMWEEKS", "1");
MsiGetProperty(hMSI,"WEEKSRETAIN",svValue,strSize);
if (StrToNum (nVar, svValue) < 0) then
MessageBox ("Please enter a valid string.", INFORMATION);
endif;
if (nVar < 1) then
MessageBeep (0);
MsiSetProperty (hMSI, "VALIDNUMWEEKS", "0");
MessageBox(MSG_BAD_NUMWEEKS, INFORMATION|MB_SETFOREGROUND);
return;
endif;
if (nVar > 52) then
MessageBeep (0);
MsiSetProperty (hMSI, "VALIDNUMWEEKS", "0");
MessageBox(MSG_BAD_NUMWEEKS, INFORMATION|MB_SETFOREGROUND);
return;
endif;
end;

Edited by cmahood, 27 July 2004 - 19:02.


cmahood

cmahood
  • Members
  • 28 posts

Posted 03 August 2004 - 21:00

Does anyone know why sometimes message boxes go to the background and other times they retain focus? This looks like a bug to me.

phood

phood
  • Full Members
  • 37 posts

Posted 29 November 2007 - 23:29

In the call to MessageBox, set the uType to MB_SETFOREGROUND.

The code above will not compile.

Edited by phood, 30 November 2007 - 18:29.