Highlighted
Absent Member.
Absent Member.
569 views

[archive] Modality of DISPLAY MESSAGE BOX

[Migrated content. Thread originally posted on 28 April 2004]

I haven't played around with the MessageBox API call extensively to narrow this down, but it appears that when you use DISPLAY MESSAGE BOX with an ICON type of 3 (MB-ERROR-ICON), the runtime is automatically applying the MB_SYSTEMMODAL attribute to the message box, so that the message box window has the WS_EX_TOPMOST attribute.

This means that even if I switch to another application, the message box from my Acucobol app is stuck in the middle of the screen, waiting it to be dismissed.

Is there any way to disable that (other than changing the icon type, because I want the error icon, but not the behavior the runtime rudely assumes)? It seems kind of silly to a user that a minor error message from an accounting app would force itself to the front of all windows.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Modality of DISPLAY MESSAGE BOX

You are right, we do use the MB_SYSTEMMODAL for errors, which then enforces the messagebox to be topmost.

There are various reasons for why we did this, if you would like to have this changed or extended, you will have to take that as an enhancement request via Tech Support.

So, are you stuck?

Seems so, you could have tried to modify the windows style when it displays, but unfortunately, as DISPLAY MESSAGE BOX is and API function, COBOL multithreading won't work.

I suggest you do your own messagebox.cbl, it shouldn't be that much hassle?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Modality of DISPLAY MESSAGE BOX

We aren't stuck, it's just a behavior that users find strange.

I know there are ways we can work around it, but they have their downsides - in particular, we lose the DISPLAY MESSAGE BOX syntax where we can easily append multiple strings together, so it's not a simple replacement. The second is administrative - we have lots of DISPLAY MESSAGE BOX statements and lots of programs (over 1000). Changing them would require them to go through our QA process for testing, and that's not going to be acceptable to management.

I'll send something to tech support requesting an enhancement.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.