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

  1. /**********************************************************
  2.  
  3. HTBGraph.cpp 
  4. Copyright TransEra Corporation 1999.
  5.  
  6. ***********************************************************/
  7.  
  8.  
  9. #include "stdafx.h"
  10. #include "HTBgraph.h"
  11. #include "GraphDlg.h"
  12. #include "DialogThread.h"
  13.  
  14.  
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20.  
  21.  
  22. BEGIN_MESSAGE_MAP(CHTBgraphApp, CWinApp)
  23.     //{{AFX_MSG_MAP(CHTBgraphApp)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. CHTBgraphApp::CHTBgraphApp() 
  30. {
  31.     
  32. }
  33.  
  34. CHTBgraphApp theApp;
  35.  
  36. short g_XPos;
  37. short g_YPos;
  38. long * pBasicVar0;
  39. long * pBasicVar1;
  40. long * pBasicVar2;
  41.  
  42. GraphDlg * g_GraphVar;
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. /*
  46.     Function:        Graph
  47.  
  48.     Description:    Starts the graph DLL
  49.  
  50.     Return type:    void 
  51.     Argument:        long* pBasicIn0
  52.     Argument:        long* pBasicIn1
  53.     Argument:        long* pBasicIn2
  54.     Argument:        short * Xpos
  55.     Argument:        short * Ypos
  56.  
  57.     Notes:            Brings information in from HTBasic and sends values [pointers]
  58.                     to appropriate variables.  Sets values for initial dialog location
  59.                     and establishes communication paths through the DLL to HTBasic.
  60.         
  61. */
  62. void Graph(long* pBasicIn0, long* pBasicIn1, long* pBasicIn2, short InXpos, short InYpos) 
  63. {
  64.         g_XPos = InXpos;                // Assign start X position to Dialog box
  65.         g_YPos = InYpos;                // Assign start Y position to Dialog box
  66.  
  67.     if (g_GraphVar == NULL) 
  68.     {
  69.         pBasicVar0 = pBasicIn0;
  70.         pBasicVar1 = pBasicIn1;
  71.         pBasicVar2 = pBasicIn2;
  72.         CWinThread * pThread = AfxBeginThread(RUNTIME_CLASS (DialogThread));    // create thread to execute dialog
  73.     }
  74. }
  75.  
  76. /////////////////////////////////////////////////////////////////////////////
  77. /*
  78.     Function:        Closegraph
  79.  
  80.     Description:    Closes down the Thread and window
  81.  
  82.     Return type:    void 
  83.  
  84.     Notes:            This function will cleanly shut down the worker thread and 
  85.                     then bring all operations to a close within this memory space.        
  86. */
  87. void Closegraph() 
  88. {    
  89.     if (g_GraphVar != NULL) 
  90.     {    
  91.         g_GraphVar->KillTimer(1);            // stop timer from updating dialog
  92.         g_GraphVar->EndDialog(1);            // tell dialog to end
  93.         g_GraphVar = NULL;                    // set pointer to NULL to show no dialog running (dialog is still shutting down)
  94.         
  95.     }
  96. }