home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / sysutils / mshell / source / menu.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-05  |  2.1 KB  |  81 lines

  1. // menu.c
  2.  
  3. // menu commands get processed here. Called from WM_COMMAND case in mshell.c
  4.  
  5.  
  6. #define INCL_PM
  7. #include <os2.h>
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12.  
  13. #include "def.h"
  14. #include "mshell.h"
  15. #include "pmassert.h"
  16.  
  17.  
  18. MRESULT Command( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  19. {
  20.   PGLOBALS    pg;
  21.   ULONG       rc;
  22.  
  23.  
  24.   pg = (PGLOBALS) WinQueryWindowULong( hwnd, QWL_USER );
  25.  
  26.   switch( SHORT1FROMMP( mp1 )) {
  27.   case IDM_ABOUT:
  28.  
  29. #define ABOUT_TEXT "\
  30. MShell is an alternative, simple shell for OS/2 2.X that uses the \
  31. replaceable shell architecture of the Workplace Shell.\n\
  32. \n\
  33. To configure MShell, name MSHELL.EXE on the RUNWORKPLACE setting in CONFIG.SYS and reboot. \
  34. MShell uses a plain text INI file called MSHELL.INI located in the root of the \
  35. boot drive.  If it does not exist, MShell will create one.\n\
  36. \n\
  37. (c) Copyright International Business Machines Corporation 1992.\n\
  38. All rights Reserved.\n\
  39. \n\
  40. Monte Copeland, IBM Boca Raton."
  41.  
  42.     WinMessageBox( HWND_DESKTOP, pg->hwndFrame, ABOUT_TEXT, CAPTION, 0, MB_CANCEL | MB_INFORMATION );
  43.     break;
  44.  
  45.  
  46.  
  47.   case IDM_CMD:
  48.     WinSendMsg( hwnd, WM_USER_DISABLE_CLIENT, 0, 0 );
  49.     WinPostMsg( pg->hwndObject, WM_USER_START_CMD, (MPARAM) hwnd, 0 );
  50.     break;
  51.  
  52.   case IDM_REFRESH:
  53.     WinSendMsg( hwnd, WM_USER_DISABLE_CLIENT, 0, 0 );
  54.     WinPostMsg( pg->hwndObject, WM_USER_ADD_PROGRAMS, (MPARAM) hwnd, 0 );
  55.     break;
  56.  
  57.   case IDM_SAVE:
  58.     WinBroadcastMsg( HWND_DESKTOP, WM_SAVEAPPLICATION, 0, 0, BMSG_POST );
  59.     break;
  60.  
  61.   case IDM_SHUTDOWN:
  62.     rc = WinMessageBox( HWND_DESKTOP, pg->hwndFrame, "Shutdown now?", CAPTION, 0, MB_YESNOCANCEL );
  63.     if( MBID_YES == rc ) {
  64.       pg->fShutdownCalled = TRUE;
  65.       WinShutdownSystem( pg->hab, pg->hmq );
  66.     }
  67.     break;
  68.  
  69.  
  70.   case IDM_SPOOLER:
  71.     // show the spooler dialog
  72.     WinSetWindowPos( pg->hwndSpooler, HWND_TOP, 0,0,0,0, SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER );
  73.     // punch the refresh button for the user
  74.     WinPostMsg( pg->hwndSpooler, WM_COMMAND, (MPARAM)IDC_REFRESH, 0 );
  75.     break;
  76.  
  77.   }
  78.   return (MRESULT) 0;
  79. }
  80.  
  81.