home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / MEMSZ211.ZIP / ABOUT.CC next >
Text File  |  1993-06-10  |  5KB  |  172 lines

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