home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 038 / dho_9a.zip / APPLICAT.CC next >
Text File  |  1994-10-12  |  3KB  |  103 lines

  1. // Developer Helper Object Set, (C) 1994 Thomas E. Bednarz, Jr.
  2. //  All rights reserved
  3.  
  4.  
  5. #include"applicat.h"
  6. #include<stdlib.h>
  7.  
  8. CHAR MWtitle[]= "Standard Window";
  9.  
  10.  
  11. //-------------------------------------------------------------------
  12. //   TApplication
  13. TApplication::TApplication(ULONG resource)
  14. {   
  15.    Application = this;
  16.    Proc = new TProcess;
  17.    fResource = resource;
  18.    if (Proc==NULL)
  19.    {
  20.       WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, 
  21.          (PSZ)"Couldn't create Process Object", 
  22.          (PSZ)"Error!",0, MB_MOVEABLE | MB_CANCEL ); 
  23.       exit(1);
  24.    }
  25.    MainWin=NULL;
  26. }
  27.  
  28. //-------------------------------------------------------------------
  29. //   init
  30. void TApplication::init(void)
  31. {
  32.    CreateMainWindow();
  33.    if (MainWin!=NULL)
  34.    {
  35.        if (!MainWin->Init(Proc->getAnchorBlock()))
  36.        {
  37.          WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, 
  38.             (PSZ)"Couldn't create Window Frame", 
  39.             (PSZ)"Error!",0, MB_MOVEABLE | MB_CANCEL ); 
  40.        exit(1);
  41.         }
  42.    }
  43.    else
  44.    {
  45.       WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, 
  46.          (PSZ)"Couldn't create Window Object", 
  47.          (PSZ)"Error!",0, MB_MOVEABLE | MB_CANCEL ); 
  48.       exit(1);
  49.    }
  50. }
  51.  
  52.  
  53. //-------------------------------------------------------------------
  54. //   run
  55. void TApplication::run(void)
  56. {
  57.    //  Standard message processing loop. WinGetMsg returns FALSE if the  
  58.    //  returned message is WM_QUIT.  Returns TRUE for all other messages 
  59.  
  60.       while (WinGetMsg(Proc->getAnchorBlock(), &QueMsg, HMODULE(NULL),0,0))
  61.          WinDispatchMsg(Proc->getAnchorBlock(), &QueMsg);
  62.  
  63. }
  64.  
  65.  
  66. //-------------------------------------------------------------------
  67. //   done
  68. void TApplication::done(void)
  69. {
  70.    if (MainWin!=NULL)
  71.       delete(MainWin);
  72.    if (Proc!=NULL)
  73.       delete(Proc);
  74. }
  75.  
  76. //-------------------------------------------------------------------
  77. //   CreateMainWindow
  78. void TApplication::CreateMainWindow(void)
  79. {
  80.    MainWin = new TWindow(MWtitle,DefaultFlags,fResource);
  81. }
  82.  
  83. //-------------------------------------------------------------------
  84. //   getClassName
  85. const char *TApplication::getClassName(void)
  86. {
  87.    return "TApplication";
  88. }
  89.  
  90. //-------------------------------------------------------------------
  91. //   getAnchorBlock
  92. HAB TApplication::getAnchorBlock()
  93. {
  94.    return Proc->getAnchorBlock();
  95. }
  96.  
  97. //-------------------------------------------------------------------
  98. //   getMainWindow
  99. TWinBase *TApplication::getMainWindow(void)
  100. {
  101.    return MainWin;  
  102. }
  103.