dcl-MessageBox language

Started by domenicomaria, May 28, 2026, 09:35:09 AM

Previous topic - Next topic

domenicomaria

(dcl-MessageBox  "aaaaaaaaa\n\nbbbbbbbbbbbb\n\ncccccccccccccccc\n\nddddddddddd\n\n" "title" 15 3)

returns what is shown in the attached image ...
...
There are 2 buttons : "SI" and "NO"
...
But I want "YES" and not "SI" !
(I am in Italy but want use english language)

Is there a way to obtain this ?

https://www.theswamp.org/index.php?topic=60628.0

owenwengerd

Windows provides the button captions, so you would need to change it in Windows somehow. I'm afraid you'll need to create your own message box form if you want to customize it.
Owen Wengerd (Outside The Box) / ManuSoft

domenicomaria

This is no small feat.

The form must resize based on the number of lines of text,
the font size, the font type, the max length of the strings, contain all the necessary icons, and have one or two or three buttons, with various different texts, with various different returns, positioned differently depending on the case, and specify which button should be the default ... !

and I don't know if I forgot something !

domenicomaria

        // ----- ads_dcl_messagebox symbol (do not rename)
        static int ads_dcl_messagebox(void)
        {
                struct resbuf *pArgs =acedGetArgs () ;
 
                CString sMessage;
                if( !GetStringArgument( pArgs, sMessage ) )
                        return RSERR; //arguments expected
 
                CString sTitle = theWorkspace.GetAppKey();
                GetStringArgument( pArgs, sTitle, true );
 
                DWORD dwMsgBoxType = 0;
                //optional arguments
                int fButtonStyle = 0;
                int fIconStyle = 0;
                bool bShowHelpButton = false;
                int languageid = 0;
                if( GetIntArgument( pArgs, fButtonStyle, true ) )
                {
                        //convert the arguments into windows messagebox type flags
                        switch (fButtonStyle)
                        {
                        case 1: dwMsgBoxType = MB_ABORTRETRYIGNORE|MB_DEFBUTTON1; break;
                        case -1: case 0: case 2: dwMsgBoxType = MB_OK|MB_DEFBUTTON1; break;
                        case 3: dwMsgBoxType = MB_OKCANCEL|MB_DEFBUTTON1; break;
                        case 4: dwMsgBoxType = MB_RETRYCANCEL|MB_DEFBUTTON1; break;
                        case 5: dwMsgBoxType = MB_YESNO|MB_DEFBUTTON1; break;
                        case 6: dwMsgBoxType = MB_YESNOCANCEL|MB_DEFBUTTON1; break;
                        case 11: dwMsgBoxType = MB_ABORTRETRYIGNORE|MB_DEFBUTTON2; break;
                        case 13: dwMsgBoxType = MB_OKCANCEL|MB_DEFBUTTON2; break;
                        case 14: dwMsgBoxType = MB_RETRYCANCEL|MB_DEFBUTTON2; break;
                        case 15: dwMsgBoxType = MB_YESNO|MB_DEFBUTTON2; break;
                        case 16: dwMsgBoxType = MB_YESNOCANCEL|MB_DEFBUTTON2; break;
                        case 21: dwMsgBoxType = MB_ABORTRETRYIGNORE|MB_DEFBUTTON3; break;
                        case 26: dwMsgBoxType = MB_YESNOCANCEL|MB_DEFBUTTON3; break;
                        default: HandleArgValueError( pArgs ); return RSERR; //invalid argument value
                        }
                        if( GetIntArgument( pArgs, fIconStyle, true ) )
                        {
                                switch (fIconStyle)
                                {
                                case 0: break;
                                case 1: dwMsgBoxType |= MB_ICONEXCLAMATION; break;
                                case 2: dwMsgBoxType |= MB_ICONINFORMATION; break;
                                case 3: dwMsgBoxType |= MB_ICONQUESTION; break;
                                case 4: dwMsgBoxType |= MB_ICONSTOP; break;
                                default: HandleArgValueError( pArgs ); return RSERR; //invalid argument value
                                }
                                GetBoolArgument( pArgs, bShowHelpButton, true );
                        }
                }
 
                GetIntArgument(pArgs, languageid, true);
 
                if( !AssertOutOfArgs( pArgs ) )
                        return RSERR;
 
                if( bShowHelpButton )
                        dwMsgBoxType |= MB_HELP;
 
                acedRetInt(MessageBoxExW(theArxWorkspace.GetTopmostModalForm(), sMessage, sTitle, dwMsgBoxType, languageid));
                return (RSRSLT) ;
        }


written by AKA Daniel


Owen,
do you think this code could be useful?

owenwengerd

I doubt that anyone else will use it, but if you tested it and it works for your needs, I can add it.
Owen Wengerd (Outside The Box) / ManuSoft