Announcement

Collapse
No announcement yet.

How to quit an application

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

  • How to quit an application

    Quitting a DDT-style application is quite easy from within PBMain. Simply perform an EXIT FUNCTION.
    But how do you perform this from within, for instance, a CALLBACK FUNCTION?

    This is a program flow example:
    From within the main module (PBMain) my application calls a procedure (SUB) to build a DDT-style
    modal dialog, containing a Quit-button and a Next-button. In case the user clicks the Quit-button, its
    CALLBACK FUNCTION performs a modeless dialog: "Do you really want to quit?". Also this dialog has
    2 buttons (yes and no). Clicking the yes-button should end the application.

    Struggled 2 days with this problem. When the modeless dialog ends (using: DIALOG END CBHNDL)
    "DIALOG END globalHandl, 0" lets also disappear the modal dialog correctly from the screen, but
    the application does not really quit. Program flow seems to return to the main module, but
    despite "IF result = 0 THEN EXIT FUNCTION", I need Windows task manager (Ctrl/Alt/Del) to delete
    my application from memory. What do I forget?


    ------------------
    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 ***

  • #2
    It "sounds" like you still have a message pump running, even though the "main" dialog has been destroyed.

    Is the main dialog a modal or modeless dialog? If you used DIALOG SHOW MODAL in PBMAIN then DIALOG END in response to the "quit" button should dismiss the dialog and PBMAIN code will continue running or close the whole app (depending on what the rest of the code does).

    If you can post the actual code, we can probably spot the problem fairly quickly.



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

    Comment


    • #3
      Lance,

      Unf. the code is too long to post (60 KB, compiled). I'll try to isolate and copy the problem to a separate, significant shorter 'application'
      during the weekend.
      Thanks, so far.

      ------------------
      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


      • #4
        Sorry, Lance.

        I forgot this important line: "IF result = 0 THEN EXIT FUNCTION".
        So it was not despite this line, but due to the lack of it. I must have
        overlooked time after time.
        In other words: problem solved.
        Thanks anyhow for your kind attention.

        ------------------
        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