QueryOptionsDlg.cpp
资源名称:ISQL_src.zip [点击查看]
上传用户:jsxglz
上传日期:2007-01-03
资源大小:117k
文件大小:3k
源码类别:
SQL Server
开发平台:
Visual C++
- // QueryOptionsDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "interactivesql.h"
- #include "QueryOptionsDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- const char* g_szQueryOptions = "QueryOptions";
- const char* g_szThreadPriority = "ThreadPriority";
- const char* g_szTimeCritical = "Time critical";
- const char* g_szHighest = "Highest";
- const char* g_szAboveNormal = "Above Normal";
- const char* g_szNormal = "Normal";
- const char* g_szBelowNormal = "Below Normal";
- const char* g_szLowest = "Lowest";
- /////////////////////////////////////////////////////////////////////////////
- // CQueryOptionsDlg dialog
- CQueryOptionsDlg::CQueryOptionsDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CQueryOptionsDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CQueryOptionsDlg)
- //}}AFX_DATA_INIT
- }
- void CQueryOptionsDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CQueryOptionsDlg)
- DDX_Control(pDX, IDC_EXECUTION_PRIORITY, m_cbThreadPriority);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CQueryOptionsDlg, CDialog)
- //{{AFX_MSG_MAP(CQueryOptionsDlg)
- ON_BN_CLICKED(IDC_RESET, OnReset)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CQueryOptionsDlg message handlers
- void CQueryOptionsDlg::OnReset()
- {
- m_cbThreadPriority.SelectString(-1, g_szNormal);
- UpdateData(FALSE);
- }
- BOOL CQueryOptionsDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szTimeCritical),
- THREAD_PRIORITY_TIME_CRITICAL);
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szHighest),
- THREAD_PRIORITY_HIGHEST);
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szAboveNormal),
- THREAD_PRIORITY_ABOVE_NORMAL);
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szNormal),
- THREAD_PRIORITY_NORMAL);
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szBelowNormal),
- THREAD_PRIORITY_BELOW_NORMAL);
- m_cbThreadPriority.SetItemData(
- m_cbThreadPriority.AddString(g_szLowest),
- THREAD_PRIORITY_LOWEST);
- m_strThreadPriority = AfxGetApp()->GetProfileString(g_szQueryOptions, g_szThreadPriority);
- m_strThreadPriority.TrimRight();
- m_strThreadPriority.TrimLeft();
- if(m_strThreadPriority.IsEmpty())
- m_strThreadPriority = g_szNormal;
- m_cbThreadPriority.SelectString(-1, m_strThreadPriority);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CQueryOptionsDlg::OnOK()
- {
- UpdateData(TRUE);
- m_cbThreadPriority.GetWindowText(m_strThreadPriority);
- AfxGetApp()->WriteProfileString(g_szQueryOptions, g_szThreadPriority, m_strThreadPriority);
- CDialog::OnOK();
- }