home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Samples / GTakPM / Source / GTPMMonitor.cpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  1KB  |  71 lines

  1. // GTakPM
  2. // (c) Benjamin Stein 1994
  3. // All Rights Reserved
  4. // GTPMMonitor.cpp
  5.  
  6.  
  7. //  $Header: W:/Projects/OCL/Samples/GTakPM/Source/rcs/GTPMMonitor.cpp 1.50 1996/08/11 23:48:08 B.STEIN Release $
  8.  
  9. #include "..\Source\GTakPM.hpp"
  10.  
  11.  
  12. GTPMMonitor::GTPMMonitor()
  13.  : OFrame(MONITOR_ICO, 
  14.           FCF_SIZEBORDER |
  15.           FCF_ICON |
  16.           FCF_SYSMENU | 
  17.           FCF_TITLEBAR |
  18.           FCF_MINMAX |
  19.           FCF_SHELLPOSITION),
  20.    OPipeTool((PSZ)NULL, (PSZ)NULL)
  21. {
  22.  if (!createFrame("GTakPM Monitor"))
  23.    throwGTPM(ERROR_FRAME_NOT_CREATED);
  24.  box = new OListBox(this, LS_NOADJUSTPOS | LS_HORZSCROLL);
  25.  if (!box->createListBox(0,0,0,0)) 
  26.    throw GTPMException(ERROR_LISTBOX_CREATION, OException::fatal);
  27.  box->setBackColor(SYSCLR_WINDOW);
  28.  box->setForeColor(SYSCLR_WINDOWTEXT);
  29.  box->setFont("8.Helv");
  30. }
  31.  
  32.       
  33.  
  34. GTPMMonitor::~GTPMMonitor()
  35.  {}
  36.  
  37. BOOL GTPMMonitor::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
  38. {
  39.  switch(msg)
  40.   {
  41.    case WM_SIZE:
  42.      if (!box) break; 
  43.      WinSetWindowPos(box->hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
  44.                      SWP_SIZE | SWP_MOVE);
  45.      break;
  46.  
  47.    case WM_CLOSE:
  48.      cancelClose();
  49.      hideFrame();
  50.      break;
  51.  
  52.    default:
  53.      return(FALSE);
  54.   }
  55.  return(TRUE);
  56. }
  57.  
  58.  
  59. void GTPMMonitor::printout()
  60. {
  61.  OPMinit init;
  62.  
  63.  while(pipe.getline(readBuffer.text, bufferSize))
  64.   {
  65.    readBuffer.rightCut("\r");
  66.    box->insertItem(readBuffer);
  67.   }
  68. }
  69.  
  70. // end of source
  71.