Announcement

Collapse
No announcement yet.

Standard Pushbutton Text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Standard Pushbutton Text

    When I use MessageBox I get standard text for pushbuttons like OK and CANCEL. That strings are Windows-defined, and can be different language with respect all other messages in my program (when I use dialogs I give my own text for that kind of pushbuttons)... Pushbuttons show different "standard" messages in messageboxes and dialogs. This happens frequently on non-english computers (e.g. english programs on italian version of Windows).

    I can imagine 3 ways to change this problem:
    1) To get the standard strings windows uses in messageboxes via some API call (I didn't find it - does it exist?) and use that string to create pushbuttons in dialogs. This way I will possibly have language confusion, but pushbutton behavior will be the same in messageboxes and dialogs.
    2) To change the standard strings windows will use in messageboxes (other API call?).
    3) To write my own MessageBox function (a standard dialog box).

    May be the only possible way is #3... but I liked not to write an at least 200 rows function to do the same a simple MsgBox call does.

    ------------------
    Rgds, Aldo

  • #2
    Aldo,
    When using an Italian edition of Windows those buttons should show up with Italian text. Maybe not for OK and Cancel, but anyhow for Yes, No, Retry and Ignore.
    If your Windows version is English however, you better create your own message boxes. See my message box functions in the source code forum. And keep in touch with that page, because later today the routine will be refreshed with a better one.
    BTW: The Windows API has a messagebox function using a language identifier, but Microsoft admits that it does'nt work.

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    [This message has been edited by Egbert Zijlema (edited March 28, 2001).]

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

    Comment


    • #3
      Egbert,

      thanks for your code (and thanks for the new code in advance). I guessed 200 rows of code, your routine is 180...


      ------------------
      Rgds, Aldo

      Comment


      • #4
        Each language version of Windows stores these keywords inside some
        files. In my Swedish version, I can see the Swedish, localized strings
        for Cancel, etc in USER.EXE for example, but how to reach them, I
        simply don't know.

        Once spent an hour at MSDN, trying to find any info on System resource
        strings, but didn't find anything useful at all. Very strange. Would
        be very useful to know, so one can use NO/CANCEL buttons, etc, with
        same language as MessageBoxes in own dialogs.

        One can use FormatMessage and %FORMAT_MESSAGE_FROM_SYSTEM to get
        localized Error strings without any problems, so it should be
        possible to get those other strings as well. Question is how..


        ------------------

        Comment


        • #5
          Borje,

          The most likely explanation for this is that Microsoft intended to have an API function that supports this.
          Well, the function is there: MessageBoxEx(hWnd, text, caption, style, language), but in MSDN 'they' admit that it does not work.
          Maybe it will in W2000? If you have W2000, simply tryout this function.

          ------------------
          mailto:[email protected][email protected]</A>
          www.basicguru.com/zijlema/

          Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
          http://zijlema.basicguru.eu
          *** Opinions expressed here are not necessarily untrue ***

          Comment


          • #6
            It's in Win2K, but does not work (at least it does not work for me, but I only have US Language support installed).


            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              What's wrong with standart MessageBox (or PB Msgbox) ?
              To change/set a text on buttons requires 10-15 statements only.
              (SetWindowsHook, WH_CBT; base idea - see MSDN, HOWTO: Position a MsgBox Using a Windows Hook Procedure
              ID: Q180936)


              ------------------
              E-MAIL: [email protected]

              Comment


              • #8
                Semen, the idea behind this is to be able to use exact same strings
                on Cancel/No, etc, buttons in our own dialogs, as a messagebox do.
                While not a perfect localization, it provides a more "professional"
                and streamlined touch to an application, IMHO.

                PBedit's Options dialog actually does this. While the control's
                text are in English, the Cancel and Help buttons are in Swedish -
                in my installation, that is. Maybe they have used common control's
                Pager control for this? Seems to be some localized string table
                inside the common control DLL too..

                What I don't understand, is why this has to be such an mystery. Don't
                Microsoft want us to know how they do it? I'm pretty sure it's very
                easy, once one finds out how it can be done..


                ------------------


                [This message has been edited by Borje Hagsten (edited March 28, 2001).]

                Comment


                • #9
                  PBEDIT uses the PropertySheet API call for Options handling.

                  ------------------
                  Tom Hanlin
                  PowerBASIC Staff

                  Comment


                  • #10
                    Borje,

                    The Multilingual UI (aka MUI)dll resource files can be found
                    under the main OS directory. For NT this MUI subdirectory can
                    found under system32. The mui sub will have various
                    subdirectorys listed under it in the language ID for a specific
                    one that you require.

                    If you have MSDEV or someother advanced resource sniffer, then
                    try opening the dll listed in one of the directorys in resource
                    mode. Under string resources, you'll find the main language
                    specifier name.

                    Cheers,
                    Cecil




                    ------------------

                    Comment


                    • #11
                      Lance,

                      If it should work in the same way month- and day-names work, I can imagine the following routine:
                      1. retrieve language identifier from the local machine
                      2. launch MessageBoxEx with the found langID as last param
                      On your machine this will return English MB-buttons of course, but running this code on my machine should create Dutch buttons (no need to send me a demo though, because I don't have W2000).
                      It should, however, also be possible to force a foreign language for the buttons using a self-created MAKELANGID.

                      What I really think? Microsoft did'nt implement it at all, simply because most Windows users have a language specific edition. So their buttons are in their own language by default.
                      Only when you use an English Windows combined with non-English Regional Settings, the MessageBoxEx function can be really functional.

                      ------------------
                      mailto:[email protected][email protected]</A>
                      www.basicguru.com/zijlema/

                      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                      http://zijlema.basicguru.eu
                      *** Opinions expressed here are not necessarily untrue ***

                      Comment

                      Working...
                      X