home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!ukma!gatech!concert!decwrl!borland.com!chard
- From: chard@borland.com (Richard Nelson)
- Subject: Re: BPW: Closing MainWindow ???
- Message-ID: <1993Jan27.222850.9161@borland.com>
- Originator: chard@genghis.borland.com
- Keywords: cm_Exit
- Sender: news@borland.com (News Admin)
- Organization: Borland International
- References: <1993Jan22.144222.8672@scf.loral.com>
- Date: Wed, 27 Jan 1993 22:28:50 GMT
- Lines: 37
-
- In article <1993Jan22.144222.8672@scf.loral.com> andres@scf16.scf.loral.com (Jeff Andres) writes:
- >Using BPW and the resource workshop, I've used the skelton features
- >of a Borland program to begin hacking/programming in windows. The
- >program I started with (as I recall) didn't have an Exit function
- >but it did of course have the standard window close call. I wanted
- >to add the Exit feauture so I went into RW and created one with some
- >bogus return code (99). My program could capture this but I couldn't
- >quite figure out how to shutdown the windows....yes, RTFM...I see
- >CanClose, but not CLOSE...I see DESTROY, but that doesn't appear
- >to really shutdown/clean-up gracefully....hints ???
- >
- >After getting frustrated, I decided that Borland had to have added this
- >feature into one of their examples and stumbled upon HeapSpy. Glancing
- >through their code I could not find where their Exit was called. I
- >opened their Menu using RW (HeapSpy.res) and found out that their return
- >code was set to something like 23400. So I took a chance and changed my
- >code of 99 to 23400 and BAM, it worked...what is so special about this
- >number and where is it documented....are there other reserved return
- >codes ???
-
- That's the standard behavior of all ObjectWindows applications. That
- magic number you stumbled onto is the value of cm_Exit, the constant
- for the menu command on the standard File|Exit menu item.
-
- TWindowsObject has a method called CMExit. The application normally
- dispatches the message containing the cm_Exit command to the
- application's main window, calling the CMExit method. CMExit checks
- with CanClose, and if CanClose returns True, terminates the
- application.
-
- I just noticed that this isn't really explained in the appropriate
- place in the chapter on application objects. This time, anyway. :-)
- --
- =========================================================================
- Richard Nelson, Borland Int'l | chard@borland.com | Go Bears! Grrr-rah!
- Had this been Borland's opinion, I would have written it in a manual.
- "How can love survive in such a graceless age?" - Don Henley
-