home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / memsz200.zip / ABOUT.CC next >
Text File  |  1993-05-28  |  5KB  |  170 lines

  1. /******************************************************************* ABOUT.CC
  2.  *                                        *
  3.  *              Generic "About" Dialog                *
  4.  *                                        *
  5.  ****************************************************************************/
  6.  
  7. #define INCL_BASE
  8. #define INCL_WIN
  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.   USHORT 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.   USHORT 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.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  85. }
  86.  
  87. /****************************************************************************
  88.  *                                        *
  89.  *    Process commands received by the About Dialog                *
  90.  *                                        *
  91.  ****************************************************************************/
  92.  
  93. static MRESULT APIENTRY Command
  94.   HWND hwnd, 
  95.   USHORT msg, 
  96.   MPARAM mp1, 
  97.   MPARAM mp2
  98. )
  99. {
  100.  /***************************************************************************
  101.   * Local Declarations                                *
  102.   ***************************************************************************/
  103.  
  104.   static METHOD Methods [] =
  105.   {
  106.     { DID_OK,      OK     },
  107.     { DID_CANCEL, Cancel },
  108.   } ;
  109.  
  110.  /***************************************************************************
  111.   * Dispatch the message without a default message processor.            *
  112.   ***************************************************************************/
  113.  
  114.   return ( DispatchMessage ( hwnd, SHORT1FROMMP(mp1), mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), NULL ) ) ;
  115.  
  116.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  117. }
  118.  
  119. /****************************************************************************
  120.  *                                        *
  121.  *    Process the About Dialog's OK button being pressed.                 *
  122.  *                                        *
  123.  ****************************************************************************/
  124.  
  125. static MRESULT APIENTRY OK
  126.   HWND hwnd, 
  127.   USHORT msg, 
  128.   MPARAM mp1, 
  129.   MPARAM mp2
  130. )
  131. {
  132.  /***************************************************************************
  133.   * Dismiss the dialog with a TRUE status.                    *
  134.   ***************************************************************************/
  135.  
  136.   WinDismissDlg ( hwnd, TRUE ) ;
  137.  
  138.   return ( 0 ) ;
  139.  
  140.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  141. }
  142.  
  143. /****************************************************************************
  144.  *                                        *
  145.  *    Process the About Dialog's being cancelled.                         *
  146.  *                                        *
  147.  ****************************************************************************/
  148.  
  149. static MRESULT APIENTRY Cancel
  150.   HWND hwnd, 
  151.   USHORT msg, 
  152.   MPARAM mp1, 
  153.   MPARAM mp2
  154. )
  155. {
  156.  /***************************************************************************
  157.   * Dismiss the dialog with a TRUE status.                    *
  158.   ***************************************************************************/
  159.  
  160.   WinDismissDlg ( hwnd, FALSE ) ;
  161.  
  162.   return ( 0 ) ;
  163.  
  164.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;
  165. }
  166.