home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / memsz231.zip / ABOUT.CPP next >
Text File  |  1994-02-28  |  6KB  |  162 lines

  1. /****************************************************************** ABOUT.CPP
  2.  *                                                                          *
  3.  *                        Generic "About" Dialog                            *
  4.  *                                                                          *
  5.  ****************************************************************************/
  6.  
  7. #define INCL_BASE
  8. #define INCL_PM
  9. #include <os2.h>
  10.  
  11. #include "support.h"
  12. #include "about.h"
  13.  
  14.  
  15. /****************************************************************************
  16.  *                                                                          *
  17.  *                     Definitions & Declarations                           *
  18.  *                                                                          *
  19.  ****************************************************************************/
  20.  
  21. static METHODFUNCTION InitDlg ;
  22. static METHODFUNCTION Command ;
  23. static METHODFUNCTION OK ;
  24. static METHODFUNCTION Cancel ;
  25.  
  26.  
  27. /****************************************************************************
  28.  *                                                                          *
  29.  *      "About" Dialog Processor                                            *
  30.  *                                                                          *
  31.  ****************************************************************************/
  32.  
  33. extern MRESULT EXPENTRY AboutProcessor
  34. (
  35.   HWND hwnd,
  36.   ULONG msg,
  37.   MPARAM mp1,
  38.   MPARAM mp2
  39. )
  40. {
  41.  /***************************************************************************
  42.   *                             Declarations                                *
  43.   ***************************************************************************/
  44.  
  45.   static METHOD Methods [] =
  46.   {
  47.     { WM_INITDLG, InitDlg },
  48.     { WM_COMMAND, Command }
  49.   } ;
  50.  
  51.  /***************************************************************************
  52.   * Dispatch the message according to the method table and return the       *
  53.   *   result.  Any messages not defined above get handled by the system     *
  54.   *   default dialog processor.                                             *
  55.   ***************************************************************************/
  56.  
  57.   return ( DispatchMessage ( hwnd, msg, mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), WinDefDlgProc ) ) ;
  58. }
  59.  
  60. /****************************************************************************
  61.  *                                                                          *
  62.  *      Initialize Dialog                                                   *
  63.  *                                                                          *
  64.  ****************************************************************************/
  65.  
  66. static MRESULT APIENTRY InitDlg
  67.   HWND hwnd, 
  68.   ULONG msg,
  69.   MPARAM mp1, 
  70.   MPARAM mp2
  71. )
  72. {
  73.   PABOUT_PARMS Parms = (PABOUT_PARMS) ( PVOIDFROMMP ( mp2 ) ) ;
  74.  
  75.   WinSetWindowUShort ( hwnd, QWS_ID, Parms->id ) ;
  76.  
  77.   if ( Parms->hwndHelp )
  78.   {
  79.     WinAssociateHelpInstance ( Parms->hwndHelp, hwnd ) ;
  80.   }
  81.  
  82.   return ( MRFROMSHORT ( FALSE ) ) ;
  83. }
  84.  
  85. /****************************************************************************
  86.  *                                                                          *
  87.  *      Process commands received by the About Dialog                       *
  88.  *                                                                          *
  89.  ****************************************************************************/
  90.  
  91. static MRESULT APIENTRY Command
  92.   HWND hwnd, 
  93.   ULONG msg, 
  94.   MPARAM mp1, 
  95.   MPARAM mp2
  96. )
  97. {
  98.  /***************************************************************************
  99.   * Local Declarations                                                      *
  100.   ***************************************************************************/
  101.  
  102.   static METHOD Methods [] =
  103.   {
  104.     { DID_OK,     OK     },
  105.     { DID_CANCEL, Cancel },
  106.   } ;
  107.  
  108.  /***************************************************************************
  109.   * Dispatch the message without a default message processor.               *
  110.   ***************************************************************************/
  111.  
  112.   return ( DispatchMessage ( hwnd, SHORT1FROMMP(mp1), mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), 0 ) ) ;
  113. }
  114.  
  115. /****************************************************************************
  116.  *                                                                          *
  117.  *      Process the About Dialog's OK button being pressed.                 *
  118.  *                                                                          *
  119.  ****************************************************************************/
  120.  
  121. static MRESULT APIENTRY OK
  122.   HWND hwnd, 
  123.   ULONG msg, 
  124.   MPARAM mp1, 
  125.   MPARAM mp2
  126. )
  127. {
  128.  /***************************************************************************
  129.   * Dismiss the dialog with a TRUE status.                                  *
  130.   ***************************************************************************/
  131.  
  132.   WinDismissDlg ( hwnd, TRUE ) ;
  133.  
  134.   return ( 0 ) ;
  135. }
  136.  
  137. /****************************************************************************
  138.  *                                                                          *
  139.  *      Process the About Dialog's being cancelled.                         *
  140.  *                                                                          *
  141.  ****************************************************************************/
  142.  
  143. static MRESULT APIENTRY Cancel
  144.   HWND hwnd, 
  145.   ULONG msg, 
  146.   MPARAM mp1, 
  147.   MPARAM mp2
  148. )
  149. {
  150.  /***************************************************************************
  151.   * Dismiss the dialog with a TRUE status.                                  *
  152.   ***************************************************************************/
  153.  
  154.   WinDismissDlg ( hwnd, FALSE ) ;
  155.  
  156.   return ( 0 ) ;
  157. }
  158.