ConfigureDlg.cpp
资源名称:ISQL_src.zip [点击查看]
上传用户:jsxglz
上传日期:2007-01-03
资源大小:117k
文件大小:2k
源码类别:
SQL Server
开发平台:
Visual C++
- // ConfigureDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "interactivesql.h"
- #include "ConfigureDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- const char* g_szConfigure = "Configure";
- const char* g_szLoginTimeOut = "LoginTimeOut";
- const char* g_szQueryTimeOut = "QueryTimeOut";
- /////////////////////////////////////////////////////////////////////////////
- // CConfigureDlg dialog
- CConfigureDlg::CConfigureDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CConfigureDlg::IDD, pParent)
- {
- CWinApp* pApp = AfxGetApp();
- //{{AFX_DATA_INIT(CConfigureDlg)
- m_nLoginTimeOut = pApp->GetProfileInt(g_szConfigure, g_szLoginTimeOut, 0);
- m_nQueryTimeOut = pApp->GetProfileInt(g_szConfigure, g_szQueryTimeOut, 0);
- //}}AFX_DATA_INIT
- }
- void CConfigureDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CConfigureDlg)
- DDX_Text(pDX, IDC_LOGIN_TIMEOUT, m_nLoginTimeOut);
- DDX_Text(pDX, IDC_QUERY_TIMEOUT, m_nQueryTimeOut);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CConfigureDlg, CDialog)
- //{{AFX_MSG_MAP(CConfigureDlg)
- ON_BN_CLICKED(IDC_RESET, OnReset)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CConfigureDlg message handlers
- void CConfigureDlg::OnReset()
- {
- m_nLoginTimeOut = 0;
- m_nQueryTimeOut = 0;
- UpdateData(FALSE);
- }
- void CConfigureDlg::OnOK()
- {
- UpdateData(TRUE);
- if(m_nLoginTimeOut > 99999)
- {
- AfxMessageBox("Please enter an integer between 0 and 99999.");
- GetDlgItem(IDC_LOGIN_TIMEOUT)->SetFocus();
- return;
- }
- if(m_nQueryTimeOut > 99999)
- {
- AfxMessageBox("Please enter an integer between 0 and 99999.");
- GetDlgItem(IDC_QUERY_TIMEOUT)->SetFocus();
- return;
- }
- CWinApp* pApp = AfxGetApp();
- pApp->WriteProfileInt(g_szConfigure, g_szLoginTimeOut, m_nLoginTimeOut);
- pApp->WriteProfileInt(g_szConfigure, g_szQueryTimeOut, m_nQueryTimeOut);
- CDialog::OnOK();
- }