Archive for April, 2009

Using MessageBoxes in Character Based RM/Cobol programs

Wednesday, April 8th, 2009

It is possible, easy in fact, to display a MessageBox from a character based RM/Cobol program.  All you have to do is include the windows.cpy copybook and use the WowMessageBox function.  The only real difficulty was having the MessageBox pop up under the main Cobol window.  This was due to the fact that I didn’t have the handle for the main Cobol window and was passing zero as the value of the parent window to WowMessageBox.

It turns out that there is a function to get the handle of the main Cobol window.  It is WowGetCobolHWnd.  Pass the value returned by this function to WowMessageBox and the MessageBox will pop up on top of the main Cobol window.  Simple, when you know how.