home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 93win / data1.cab / DLL_Toolkit / Source / HTBMeter / HTBmeter.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2005-03-02  |  2.0 KB  |  92 lines

  1. /***************************************************
  2. HTBMeter.dll
  3.  
  4. HTBmeter.cpp
  5.  
  6. Copyright TransEra Corporation 1999 
  7. ***************************************************/
  8. #include "stdafx.h"
  9. #include "HTBmeter.h"
  10. #include "MeterDlg.h"
  11. #include "DialogThread.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19.  
  20. BEGIN_MESSAGE_MAP(CHTBmeterApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CHTBmeterApp)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26.  
  27. CHTBmeterApp::CHTBmeterApp() 
  28. {    
  29. }
  30.  
  31. CHTBmeterApp theApp;
  32.  
  33. short g_Xpos;
  34. short g_Ypos;
  35. long * g_pBasicVar;
  36. MeterDlg * g_MeterVar;
  37.  
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. /*
  41.     Function:        Meter
  42.  
  43.     Description:    Starts the meter
  44.  
  45.     Return type:    void 
  46.     Argument:        long* pBasicVar
  47.     Argument:        short xpos
  48.     Argument:        short ypos
  49.  
  50.     Notes:            this function starts the meter dialog box and then
  51.                     sets up the window with the values coming in as parameters
  52.                     then information can go back and forth between the meter
  53.                     and HTBasic.
  54.         
  55. */
  56. void Meter(long* pBasicVar, short xpos, short ypos) 
  57. {    
  58.     g_Xpos = xpos;
  59.     g_Ypos = ypos;
  60.  
  61.     if (g_MeterVar == NULL) 
  62.     {
  63.         g_pBasicVar = pBasicVar;
  64.  
  65.         CWinThread * pThread = AfxBeginThread(RUNTIME_CLASS (DialogThread));    // create thread to execute dialog
  66.     }
  67. }
  68.  
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. /*
  72.     Function:        Closemeter
  73.  
  74.     Description:    Closes the meter    
  75.  
  76.     Return type:    void 
  77.  
  78.     Notes:            Closes the meter by NICELY shutting down the app and the 
  79.                     thread that it was running on.
  80.         
  81. */
  82. void Closemeter() 
  83. {    
  84.     if (g_MeterVar != NULL) 
  85.     {    
  86.         g_MeterVar->KillTimer(1);            // stop timer from updating dialog
  87.         g_MeterVar->EndDialog(1);            // tell dialog to end
  88.         g_MeterVar = NULL;                    // set pointer to NULL to show no dialog running (dialog is still shutting down)
  89.         
  90.     }
  91. }
  92.