home *** CD-ROM | disk | FTP | other *** search
/ ftp.funduc.com / 2014.08.ftp.funduc.com.tar / ftp.funduc.com / fshedcode-072212.zip / SelectBlockDlg.cpp < prev    next >
C/C++ Source or Header  |  2010-09-13  |  3KB  |  94 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //    License (GPLv2+):
  3. //    This program is free software; you can redistribute it and/or modify
  4. //    it under the terms of the GNU General Public License as published by
  5. //    the Free Software Foundation; either version 2 of the License, or
  6. //    (at your option) any later version.
  7. //
  8. //    This program is distributed in the hope that it will be useful, but
  9. //    WITHOUT ANY WARRANTY; without even the implied warranty of
  10. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11. //    General Public License for more details.
  12. //
  13. //    You should have received a copy of the GNU General Public License
  14. //    along with this program; if not, write to the Free Software
  15. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18. #include "stdafx.h"
  19. #include "fshed.h"
  20. #include "SelectBlockDlg.h"
  21.  
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CSelectBlockDlg dialog
  30.  
  31.  
  32. CSelectBlockDlg::CSelectBlockDlg(CWnd* pParent /*=NULL*/)
  33.     : CDialog(CSelectBlockDlg::IDD, pParent)
  34. {
  35.     //{{AFX_DATA_INIT(CSelectBlockDlg)
  36.     m_strStartOffset = _T("");
  37.     m_strEndOffset = _T("");
  38.     //}}AFX_DATA_INIT
  39.    m_nStartOffset = 0;
  40.    m_nEndOffset = 0;
  41. }
  42.  
  43.  
  44. void CSelectBlockDlg::DoDataExchange(CDataExchange* pDX)
  45. {
  46.     CDialog::DoDataExchange(pDX);
  47.     //{{AFX_DATA_MAP(CSelectBlockDlg)
  48.     DDX_Text(pDX, IDC_START_OFFSET_ED, m_strStartOffset);
  49.     //}}AFX_DATA_MAP
  50.    if (pDX->m_bSaveAndValidate)
  51.    {
  52.         if (_stscanf(m_strStartOffset, _T("x%x"), &m_nStartOffset) == 0)
  53.         {
  54.             if (_stscanf(m_strStartOffset, _T("%d"), &m_nStartOffset) == 0)
  55.             {
  56.                 AfxMessageBox (IDS_ERR_INV_OFFSET);
  57.                 pDX->Fail();
  58.             }
  59.         }
  60.    }
  61.     DDX_Text(pDX, IDC_END_OFFSET_ED, m_strEndOffset);
  62.    if (pDX->m_bSaveAndValidate)
  63.    {
  64.         if (_stscanf(m_strEndOffset, _T("x%x"), &m_nEndOffset) == 0)
  65.         {
  66.             if (_stscanf(m_strEndOffset, _T("%d"), &m_nEndOffset) == 0)
  67.             {
  68.                 AfxMessageBox (IDS_ERR_INV_OFFSET);
  69.                 pDX->Fail();
  70.             }
  71.         }
  72.    }
  73. }
  74.  
  75.  
  76. BEGIN_MESSAGE_MAP(CSelectBlockDlg, CDialog)
  77.     //{{AFX_MSG_MAP(CSelectBlockDlg)
  78.     //}}AFX_MSG_MAP
  79. END_MESSAGE_MAP()
  80.  
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CSelectBlockDlg message handlers
  83.  
  84. BOOL CSelectBlockDlg::OnInitDialog() 
  85. {
  86.     m_strStartOffset.Format(_T("x%x"), m_nStartOffset);
  87.     m_strEndOffset.Format(_T("x%x"), m_nEndOffset);
  88.  
  89.     CDialog::OnInitDialog();
  90.     
  91.     return TRUE;  // return TRUE unless you set the focus to a control
  92.                   // EXCEPTION: OCX Property Pages should return FALSE
  93. }
  94.