// opselectscondlg.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "opselectscondlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COpSelectSConDlg dialog extern HHOOK hHook; extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam); COpSelectSConDlg::COpSelectSConDlg(CWnd* pParent /*=NULL*/) : CDialog(COpSelectSConDlg::IDD, pParent) { //{{AFX_DATA_INIT(COpSelectSConDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } COpSelectSConDlg::COpSelectSConDlg(INT_PTR* pRet, CWnd* pParent /*= NULL*/) : CDialog(COpSelectSConDlg::IDD, pParent) { m_pRet = pRet; } void COpSelectSConDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COpSelectSConDlg) DDX_Control(pDX, IDC_SPT, m_sptList); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COpSelectSConDlg, CDialog) //{{AFX_MSG_MAP(COpSelectSConDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COpSelectSConDlg message handlers void COpSelectSConDlg::OnOK() { // TODO: Add extra validation here CString szCaption; if ((NULL == m_sptList.GetFirstSelectedItemPosition())) { szCaption.Empty(); szCaption.LoadString(IDS_OP_DC_SCM_SPT_NULL); hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL); MessageBox(szCaption, NULL, MB_ICONEXCLAMATION); GetDlgItem(IDC_SPT)->SetFocus(); } else { AfxGetMainWnd()->EnableWindow(); *m_pRet = RET_OK; } // CDialog::OnOK(); } void COpSelectSConDlg::OnCancel() { // TODO: Add extra cleanup here AfxGetMainWnd()->EnableWindow(); *m_pRet = RET_CANCEL; CDialog::OnCancel(); } BOOL COpSelectSConDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString strColTitle; int iColIndex = (int)VAL_ZERO; m_sptList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES); strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_CN); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_SNAME); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_CHAMOUNT); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_EAMOUNT); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_TPAMOUNT); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_DEFINER); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_DEDATE); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); iColIndex++; strColTitle.Empty(); strColTitle.LoadString(IDS_DB_SCON_DESC); m_sptList.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL COpSelectSConDlg::Create(UINT nID, CWnd* pParentWnd) { // TODO: Add your specialized code here and/or call the base class pParentWnd->EnableWindow(FALSE); return CDialog::Create(IDD, pParentWnd); } BOOL COpSelectSConDlg::DestroyWindow() { // TODO: Add your specialized code here and/or call the base class OnCancel(); return CDialog::DestroyWindow(); } void COpSelectSConDlg::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType) { // TODO: Add your specialized code here and/or call the base class CDialog::CalcWindowRect(lpClientRect, nAdjustType); } BOOL COpSelectSConDlg::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); }