Skip to main content

[archive] Threads And Display Message Box

  • September 11, 2006
  • 2 replies
  • 0 views

[Migrated content. Thread originally posted on 11 September 2006]

I have implemented threading in our application for the display of various diary reminders etc. This thread is started as the application begins and gives the focus back to the main thread. The diary process(es) use an accept before time so that they can update their data and screen display (without getting focus). All works fine it would seem UNTIL the main thread does a DISPLAY MESSAGE BOX- this seems to default to Modal and gives me some strange behaviour, sometimes the diary thread gets focus yet the main thread still sometimes receives the mouse/keyboard input and various other combinations of trouble (I think dependent on the sequence of events in the two threads).

Is there any way to get around this? or to use the message box as a modeless window?

Keith

2 replies

[Migrated content. Thread originally posted on 11 September 2006]

I have implemented threading in our application for the display of various diary reminders etc. This thread is started as the application begins and gives the focus back to the main thread. The diary process(es) use an accept before time so that they can update their data and screen display (without getting focus). All works fine it would seem UNTIL the main thread does a DISPLAY MESSAGE BOX- this seems to default to Modal and gives me some strange behaviour, sometimes the diary thread gets focus yet the main thread still sometimes receives the mouse/keyboard input and various other combinations of trouble (I think dependent on the sequence of events in the two threads).

Is there any way to get around this? or to use the message box as a modeless window?

Keith
You cannot use DISPLAY MESSAGE BOX like you do. DISPLAY MESSAGE BOX invokes a Windows API function which effectively freeze COBOL threads. Do your own message box using standard COBOL windows to circumvent this.
For an example of a self implemented message box, see the custrpt.cbl sample program and the cancel.cbl

[Migrated content. Thread originally posted on 11 September 2006]

I have implemented threading in our application for the display of various diary reminders etc. This thread is started as the application begins and gives the focus back to the main thread. The diary process(es) use an accept before time so that they can update their data and screen display (without getting focus). All works fine it would seem UNTIL the main thread does a DISPLAY MESSAGE BOX- this seems to default to Modal and gives me some strange behaviour, sometimes the diary thread gets focus yet the main thread still sometimes receives the mouse/keyboard input and various other combinations of trouble (I think dependent on the sequence of events in the two threads).

Is there any way to get around this? or to use the message box as a modeless window?

Keith
Yep - I thought that would be the answer. Thanks for the response.
Keith