// opcreatetzdlg.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "opcreatetzdlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COpCreateTzDlg dialog extern HHOOK hHook; extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam); COpCreateTzDlg::COpCreateTzDlg(CWnd* pParent /*=NULL*/) : CDialog(COpCreateTzDlg::IDD, pParent) { //{{AFX_DATA_INIT(COpCreateTzDlg) m_edName = _T(""); m_edLocation = _T(""); m_edTzDesc = _T(""); m_edCDate = CTime::GetCurrentTime(); //}}AFX_DATA_INIT } void COpCreateTzDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COpCreateTzDlg) DDX_Text(pDX, IDC_TZ_NAME, m_edName); DDV_MaxChars(pDX, m_edName, 20); DDX_Text(pDX, IDC_TZ_LOCATION, m_edLocation); DDV_MaxChars(pDX, m_edLocation, 50); DDX_Text(pDX, IDC_TZ_TZDESC, m_edTzDesc); DDV_MaxChars(pDX, m_edTzDesc, 50); DDX_DateTimeCtrl(pDX, IDC_TZ_CDATE, m_edCDate); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COpCreateTzDlg, CDialog) //{{AFX_MSG_MAP(COpCreateTzDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COpCreateTzDlg message handlers void COpCreateTzDlg::OnOK() { // TODO: Add extra validation here CString szCaption; UpdateData(TRUE); if (m_edName == _T("")) { szCaption.Empty(); szCaption.LoadString(IDS_OP_LC_TZ_NAME_NULL); hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); MessageBox(szCaption, NULL, MB_ICONEXCLAMATION); this->GetDlgItem(IDC_TZ_NAME)->SetFocus(); return; } // if (m_ZoneType.GetCurSel() == -1) // { // szCaption.Empty(); // szCaption.LoadString(IDS_OP_LC_TZ_TYPE_NULL); // hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); // MessageBox(szCaption,NULL, MB_ICONEXCLAMATION); // this->GetDlgItem(IDC_ZONE_TYPE)->SetFocus(); // return; // } // szCaption.Empty(); // m_ZoneType.GetLBText(m_ZoneType.GetCurSel(), szCaption); // if (szCaption == "1D VES | 2D ERI") // { // m_edTzType = "1"; // } // else if (szCaption == "3D ERT") // { // m_edTzType = "2"; // } m_edTzType = "3"; CDialog::OnOK(); } BOOL COpCreateTzDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL COpCreateTzDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN) { return TRUE; } if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_ESCAPE) { return TRUE; } return CDialog::PreTranslateMessage(pMsg); }