home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mnth0103.zip / Cannata / main / main.c < prev    next >
Text File  |  1992-05-30  |  2KB  |  113 lines

  1. #define  INCL_PM
  2. #define  INCL_DOS
  3.  
  4. #include <os2.h>
  5. #include <stdio.h>
  6. #include "main.h"
  7. #include "..\APIDLL\stdappu.h"
  8.  
  9.  
  10.  
  11.  
  12. MRESULT UserWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  13.  
  14.  
  15. static    PPUBSTDAPP  pPubStdApp;
  16.  
  17.  
  18. INT
  19. main (VOID)
  20. {
  21.    // Allow StdApp to use RC menu resource.
  22.    //ULONG   flExclude           = (ULONG)0;
  23.  
  24.    // Allow StdApp to dynamically build ActionBar for us.
  25.    ULONG   flExclude           =  FCF_MENU;
  26.  
  27.  
  28.    // Special services we want StdApp to do for us.
  29.    ULONG   flServices           = ( STDAPP_SERVICE_HPS           |
  30.                                       STDAPP_SERVICE_RGB           |
  31.                                        STDAPP_SERVICE_DEVRES     |
  32.                                        STDAPP_SERVICE_HELP        |
  33.                                    STDAPP_SERVICE_CONFIRM_EXIT );
  34.  
  35.  
  36.  
  37.    pPubStdApp = NewStdApp( (PVOID)UserWndProc, flExclude, flServices);
  38.    if ( !pPubStdApp )
  39.       return(USER_RETURN_ERROR);
  40.  
  41.  
  42.    pPubStdApp->pfnMsgLoop(pPubStdApp);
  43.  
  44.  
  45.    //       Any other system resources used
  46.    //       (e.g. memory or files) should be freed here
  47.  
  48.    pPubStdApp = pPubStdApp->pfnDelete(pPubStdApp);
  49.  
  50.    return USER_RETURN_SUCCESS;
  51.  
  52. } // End of main porcedure
  53.  
  54.  
  55.  
  56.  
  57. MRESULT EXPENTRY
  58. UserWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  59. {
  60.   MRESULT mr;
  61.  
  62.   switch(msg)
  63.   {
  64.  
  65.     case WM_COMMAND:
  66.     {
  67.        switch( SHORT1FROMMP(mp1) )
  68.        {
  69.           case IDMU_MSG:
  70.           {
  71.              break;
  72.           }
  73.  
  74.        }  //  end switch(SHORT1FROMMP(mp1))
  75.  
  76.        break;
  77.     }
  78.  
  79.     case WM_PAINT:
  80.     {
  81.        RECTL    rcl;
  82.  
  83.        // We get the hps because we requested one when we called
  84.        // NewStdApp and we wanted it to handle RGB colors.
  85.        HPS    hps = pPubStdApp->pfnQueryHps(pPubStdApp);
  86.  
  87.        hps = WinBeginPaint(hwnd, hps, (PRECTL)&rcl);
  88.  
  89.        WinFillRect( hps, &rcl, RGB_BLUE );
  90.  
  91.        WinEndPaint(hps);
  92.  
  93.        break;
  94.     }
  95.  
  96.     default:
  97.        // Default must call WinDefWindowProc()
  98.        mr = WinDefWindowProc(hwnd, msg, mp1, mp2);
  99.        return mr;
  100.   }
  101.  
  102.   return (MRESULT)0;
  103.  
  104. }   //      End of UserWndProc()
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.