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

  1. // ProgressDlg.cpp : implementation file
  2. // jont 7/99
  3.  
  4. #include "stdafx.h"
  5. #include "Progress.h"
  6. #include "ProgressDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. #define WIDTHADJUST 23
  15. #define HEIGHTADJUST 57
  16. #define TIMERVAL 100
  17. #define TEXTHEIGHT 11
  18.  
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // ProgressDlg dialog
  22.  
  23.  
  24. ProgressDlg::ProgressDlg(CWnd* pParent /*=NULL*/)
  25.     : CDialog(ProgressDlg::IDD, pParent)
  26. {
  27.     //{{AFX_DATA_INIT(ProgressDlg)
  28.         // NOTE: the ClassWizard will add member initialization here
  29.     //}}AFX_DATA_INIT
  30. }
  31.  
  32.  
  33. void ProgressDlg::DoDataExchange(CDataExchange* pDX)
  34. {
  35.     CDialog::DoDataExchange(pDX);
  36.     //{{AFX_DATA_MAP(ProgressDlg)
  37.     DDX_Control(pDX, IDC_PROGRESS1, m_progbar);
  38.     //}}AFX_DATA_MAP
  39. }
  40.  
  41.  
  42. BEGIN_MESSAGE_MAP(ProgressDlg, CDialog)
  43.     //{{AFX_MSG_MAP(ProgressDlg)
  44.     ON_WM_TIMER()
  45.     //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // ProgressDlg message handlers
  50.  
  51. BOOL ProgressDlg::OnInitDialog() 
  52. {
  53.     CDialog::OnInitDialog();
  54.  
  55.     // set window size and pos
  56.     SetWindowPos(FromHandle(m_hWnd),g_xpos,g_ypos,g_width+WIDTHADJUST,g_height+HEIGHTADJUST,SWP_NOZORDER );    
  57.     m_progbar.SetWindowPos(FromHandle(m_hWnd),0,0,g_width,g_height,SWP_NOZORDER | SWP_NOMOVE);    // set progress bar size and pos
  58.     
  59.     SetDlgItemText(IDC_TEXT1,g_text1);                            // set static text control text
  60.     CWnd* pStaticText = GetDlgItem(IDC_TEXT1);                    // get pointer to static text control text
  61.     pStaticText->SetWindowPos(NULL,0,0,g_width,TEXTHEIGHT,SWP_NOZORDER | SWP_NOMOVE);    // set width of static text control
  62.  
  63.     SetDlgItemText(IDC_TEXT2,g_text2);                            // set static text control text
  64.     pStaticText = GetDlgItem(IDC_TEXT2);                        // get pointer to static text control text
  65.     pStaticText->SetWindowPos(NULL,0,0,g_width,TEXTHEIGHT,SWP_NOZORDER | SWP_NOMOVE);    // set width of static text control
  66.  
  67.     m_progbar.SetRange32(g_begin,g_end);                    // set lower and upper range of progress bar
  68.  
  69.     m_progbar.SetPos(g_begin);                                // default to lower
  70.  
  71.     SetTimer(1,TIMERVAL,NULL);                                // start timer used for updateing by reference
  72.  
  73.     return TRUE;  // return TRUE unless you set the focus to a control
  74.                   // EXCEPTION: OCX Property Pages should return FALSE
  75. }
  76.  
  77. void ProgressDlg::OnTimer(UINT nIDEvent) 
  78. {
  79.     m_progbar.SetPos(*g_pBasicVar);                            // set to updated variable in Basic memory
  80.  
  81.     SetDlgItemText(IDC_TEXT1,g_text1);                        // set static text control text
  82.     SetDlgItemText(IDC_TEXT2,g_text2);                        // set static text control text
  83.     
  84.     CDialog::OnTimer(nIDEvent);                                // call parent class event
  85. }
  86.