Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

PB/CC's message box return values.

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

  • PBCC PB/CC's message box return values.

    A little something somebody else might find useful. Written in CC502
    Code:
    #BREAK ON
    #INCLUDE "win32api.inc"
                                                                    
    FUNCTION PBMAIN () AS LONG
        LOCAL ReturnValue AS LONG
        MessageBox 0, "This is a test message box.", "Test Message Box" , 5 TO ReturnValue
        PRINT;ReturnValue
        BEEP
        PRINT;"Keep on trucking."
        WAITKEY$
    
    END FUNCTION
    
    
    ' MessageBox Value                  ReturnValue returns
    ' 0 = Okay                          1 = Okay
    ' 1 = Okay, Cancel                  2 = Cancel
    ' 2 = Abort, Retry, Ignore          3 = Abort
    ' 3 = Yes, No, Cancel               4 = Retry
    ' 4 = Yes, No                       5 = Ignore
    ' 5 = Retry, Cancel                 6 = Yes
    ' 6 = Cancel, Retry, Continue       7 = No
    ' 7 = Nothing                       8 = Not Defined
    ' 8 = Nothing                       9 = Not Defined
    ' 9 = Nothing                      10 = Try Again
    '                                  11 = Continue
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

  • #2
    I am puzzled.

    The form .... To ReturnValue is a PB format, but my copy of PBCC5.02 does not
    have a messagebox function.
    The Windows API has one, but in that case the proper format would be:

    Code:
    ReturnValue = MessageBox (0, "This is a test message box.", "Test Message Box" , 5)
    Still your code works. Could you please explain why?

    Arie Verheul

    Comment


    • #3
      Originally posted by Arie Verheul View Post
      Still your code works. Could you please explain why?
      Beats me. I knew that MessageBox had to return a value somewhere. I just started playing with it and come to find out....

      I haven't tried your example but I see no reason that format couldn't be used.
      Last edited by Mel Bishop; 14 Oct 2009, 10:03 AM.
      There are no atheists in a fox hole or the morning of a math test.
      If my flag offends you, I'll help you pack.

      Comment


      • #4
        "no parens" syntax was a change in either 8x or 9x ...
        Code:
        CALL ProcName [([arguments])] [TO result_var]
        ....

        As long as ProcName is a PowerBASIC procedure, or is an external procedure declared with the DECLARE statement, you can omit the CALL keyword. If you do so, you may omit the parentheses surrounding arguments
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Thanks Michael, never came across that, useful to know.

          Well Mel, your code works perfectly allright, because it is perfectly allright. Thanks,

          Arie Verheul

          Comment


          • #6
            You are welcome, Arie.

            My original purpose for playing with it was to bring up a MessageBox without stalling the program.

            When the box comes up, the entire program is stalled until a response is provided. Something I sometimes don't want to have happen.

            Never did find an answer for that one.
            There are no atheists in a fox hole or the morning of a math test.
            If my flag offends you, I'll help you pack.

            Comment

            Working...
            X