home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / editor / pmedit5 / pmedit1.c < prev    next >
C/C++ Source or Header  |  1994-01-31  |  2KB  |  107 lines

  1. #include <OS2.H>
  2.  
  3. MRESULT EXPENTRY WndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  4.  
  5. void main()
  6.     {
  7.         HAB HAncBlk;
  8.         HMQ HMesQue;
  9.         HWND HFrame, HClient;
  10.         QMSG QueMess;
  11.         ULONG CtlData =
  12.             FCF_MINMAX        |
  13.             FCF_SHELLPOSITION |
  14.             FCF_SIZEBORDER    |
  15.             FCF_SYSMENU       |
  16.             FCF_TASKLIST      |
  17.             FCF_TITLEBAR;
  18.  
  19.         HAncBlk = WinInitialize
  20.                         (0);
  21.  
  22.         HMesQue = WinCreateMsgQueue
  23.                         (HAncBlk,
  24.                         0);
  25.  
  26.         WinRegisterClass
  27.                 (HAncBlk,
  28.                 "MAIN",
  29.                 WndProc,
  30.                 0L,
  31.                 0);
  32.  
  33.         HFrame = WinCreateStdWindow
  34.             (HWND_DESKTOP,
  35.             WS_VISIBLE,
  36.             &CtlData,
  37.             "MAIN",
  38.             ":  PM Text Editor",
  39.             0L,
  40.             0,
  41.             0,
  42.             &HClient);
  43.  
  44.         while (WinGetMsg
  45.               (HAncBlk,
  46.               &QueMess,
  47.               0,
  48.               0,
  49.               0))
  50.               WinDispatchMsg  (HAncBlk, &QueMess);
  51.  
  52.         WinDestroyWindow  (HFrame);
  53.         WinDestroyMsgQueue (HMesQue);
  54.         WinTerminate (HAncBlk);
  55.     }
  56.  
  57. MRESULT EXPENTRY Paint (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2);
  58.  
  59. MRESULT EXPENTRY WndProc
  60.     (HWND hwnd,
  61.     USHORT msg,
  62.     MPARAM mp1,
  63.     MPARAM mp2)
  64.     {
  65.         switch (msg)
  66.             {
  67.                 case WM_PAINT:
  68.                     return Paint (hwnd, msg, mp1, mp2);
  69.                 default:
  70.                     return WinDefWindowProc (hwnd,msg,mp1,mp2);
  71.             }
  72.  
  73. }
  74.  
  75. MRESULT EXPENTRY Paint (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  76.     {
  77.         HPS HPresSpace;
  78.         RECTL Rect;
  79.         static char Message [] =
  80.             "This line is display by the window procedure.";
  81.  
  82.         HPresSpace = WinBeginPaint
  83.             (hwnd,
  84.             0,
  85.             0);
  86.        WinFillRect
  87.             (HPresSpace,
  88.             &Rect,
  89.             CLR_WHITE);
  90.  
  91.        WinDrawText
  92.             (HPresSpace,
  93.             0xffff,
  94.             Message,
  95.             &Rect,
  96.             CLR_BLACK,
  97.             CLR_WHITE,
  98.  
  99.             DT_LEFT |
  100.             DT_TOP);
  101.  
  102.         WinEndPaint  (HPresSpace);
  103.         return FALSE;
  104.  
  105. }
  106.  
  107.