home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8561 < prev    next >
Encoding:
Text File  |  1993-01-27  |  2.5 KB  |  51 lines

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