home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / spmio10.zip / gcc2 / stdwin / test1.cc < prev    next >
C/C++ Source or Header  |  1994-05-21  |  728b  |  37 lines

  1. #include "stdwin.h"
  2.  
  3. class BlankWindow: public StdWin
  4. {
  5.   virtual MRESULT msg_paint ();
  6.   char *message;
  7. public:
  8.   BlankWindow (char *amessage);
  9. };
  10.  
  11. BlankWindow::BlankWindow (char *amessage)
  12. {
  13.   message = amessage;
  14. }
  15.  
  16. MRESULT BlankWindow::msg_paint ()
  17. {
  18.   // Obtain a HPS to draw with
  19.   HPS hps = WinBeginPaint (window, 0, 0);
  20.   // Erase the window
  21.   GpiErase (hps);
  22.   // Mark the repainted region as done
  23.   WinEndPaint (hps);
  24.   return 0;
  25. }
  26.  
  27. int main(void)
  28. {
  29.   // Create a window object
  30.   BlankWindow window("Hello, world!");
  31.   // Cause the window to be displayed
  32.   window.activate_window ();
  33.   // Process all PM messages until the window is closed
  34.   StdWin::StdMessageLoop ();
  35.   return 0;
  36. }
  37.