Skip to main content
Hi there,
Can I pop-up a standard Windows error/info box from a VISUAL COBOL program without calling MF Dialog/winForms etc? On launch my program looks for a config file and I'd like to pop up a simple error if missing/invalid. I could use display but a standard windows pop-up would be better. 
Thanks,
Linden
Hi there,
Can I pop-up a standard Windows error/info box from a VISUAL COBOL program without calling MF Dialog/winForms etc? On launch my program looks for a config file and I'd like to pop up a simple error if missing/invalid. I could use display but a standard windows pop-up would be better. 
Thanks,
Linden

Is this native code or managed code?

If it is managed code then you can invoke the MessageBox class as shown in the following post here:

For native code you can use the WINAPI call to MesssageBoxA

special-names.
call-convention 74 is winapi.
data division.
working-storage section.
01 retCode pic x(4) value zeroes.
01 lpText pic x(30) value z"Message Box Text".
01 lpCaption pic x(255) value z"This is caption".
01 uType pic x(4) comp-5 value 0.
procedure division.
 

    call WINAPI "MessageBoxA"  
       using by value 0 size 4
            
by reference lpText
                        
lpCaption
             by value uType
       returning retCode
    end-call.


Hi there,
Can I pop-up a standard Windows error/info box from a VISUAL COBOL program without calling MF Dialog/winForms etc? On launch my program looks for a config file and I'd like to pop up a simple error if missing/invalid. I could use display but a standard windows pop-up would be better. 
Thanks,
Linden

Thank you Chris. Native code I assume? (VS 2015 latest VC on Win 10 generating .IDY for debug and .EXE for production) - i guess that's native? I don't use .net or not knowingly.

(I'm not getting reply notifications for some reason hence just found your answer - apols.)

Regards,

Linden


Hi there,
Can I pop-up a standard Windows error/info box from a VISUAL COBOL program without calling MF Dialog/winForms etc? On launch my program looks for a config file and I'd like to pop up a simple error if missing/invalid. I could use display but a standard windows pop-up would be better. 
Thanks,
Linden
Chris,
I am using VC 2.2 update 2 native code on Redhat and when I try your reference here I get an error 173 -- Called program file not found in drive/directory: MessageBoxA

Any suggestions?

Hi there,
Can I pop-up a standard Windows error/info box from a VISUAL COBOL program without calling MF Dialog/winForms etc? On launch my program looks for a config file and I'd like to pop up a simple error if missing/invalid. I could use display but a standard windows pop-up would be better. 
Thanks,
Linden
MessageBoxA is a Windows API function and is not available under Linux. I am not sure what the similar replacement would be under Linux...