Announcement

Collapse
No announcement yet.

Closing DOS Windows

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

  • Closing DOS Windows

    Can a DOS program respond to the user closing the window its running in? I want to shut down my dos program properly if the users tries to close the window.
    Brent Boshart

  • #2
    A plain DOS program? Nope. If you were talking about a 32-bit console app, such as those produced by the PB/CC compiler, then yes it can definitely be done. And it may be possible (I don't know) using the PBDK system to "enhance" a DOS app with certain Windows capabilities. But I'm not aware of anything that would allow a standard DOS app to do that.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."

    Comment


    • #3
      Ok, then how about the following: I would like to let my program run in a DOS box. At the end of the program, it would wait for the user to press a key (or click on a [close] button) after which I want to end my program and close the DOS window.

      I know the user can choose to "pause after termination", but is there some sort of interrupt which will close the DOS window?

      ------------------
      Sebastian Groeneveld
      mailto:[email protected][email protected]</A>
      Sebastian Groeneveld
      mailto:[email protected][email protected]</A>

      Comment


      • #4
        Windows can do the close for you. Set up a desktop shortcut
        for your program. Right click on the shortcut. Click
        "Properties". Then, click on "Program" tab. Click the
        "Close on Exit" square. Click "Apply", click "Ok"

        When your program terminates, under program control, the window
        will close. You will not have to type "exit".

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

        Comment


        • #5
          Yes indeed you can replay to a window close request:
          use INT &h2F, Subfunction &h168F (see Ralph Brown's
          Interrupt list for further documentation1). First you must
          tell windows that you want to be informed of a window
          close request ("Close awareness"), then you must call
          the subfunction "Query_Close" repeatedly in your keyboard-loop. if the user klicks the windows-Close button, the Query_Close call will notify you. If you are interested, I can mail you an complete example, but it's not easy to understand because it's embedded in an multipurpose screen and keyboard i/o-unit. P.S.: running an PB/CC-Program, it IS NOT POSSIBLE to respond to window-close-requests. As far as I know, it is only possible for real-Mode MSDOS-Programs. Additionally, I don't know if the int &h2f-Methods works with Win/NT, because the NT-MSDOS-Interface is very, hm, uncomplete.

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

          Comment


          • #6
            Hi Mattias,

            I'm interested in the code too... can you please email it to me at mailto:[email protected][email protected]</A>

            Thanks in advance.


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

            Comment


            • #7
              I'd be very interested too! I had no idea that that was possible.

              -- Eric

              ------------------
              Perfect Sync: Perfect Sync Development Tools
              Email: mailto:[email protected][email protected]</A>

              "Not my circus, not my monkeys."

              Comment

              Working...
              X