// opcreatesfdlg.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "opcreatesfdlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COpCreateSFDlg dialog extern HHOOK hHook; extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam); COpCreateSFDlg::COpCreateSFDlg(CWnd* pParent /*=NULL*/) : CDialog(COpCreateSFDlg::IDD, pParent) { //{{AFX_DATA_INIT(COpCreateSFDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } COpCreateSFDlg::COpCreateSFDlg(INT_PTR* pRet, CWnd* pParent /*=NULL*/) : CDialog(COpCreateSFDlg::IDD, pParent) { m_pRet = pRet; } void COpCreateSFDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COpCreateSFDlg) DDX_Control(pDX, IDC_SPT, m_sptList); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COpCreateSFDlg, CDialog) //{{AFX_MSG_MAP(COpCreateSFDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COpCreateSFDlg message handlers BOOL COpCreateSFDlg::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 | LVS_EX_CHECKBOXES); 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_EAMOUNT); 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_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 } void COpCreateSFDlg::OnOK() { // TODO: Add extra validation here CString szCaption; bool bIsSelect = false; int iIndex = (int)VAL_ZERO; while (iIndex <= (m_sptList.GetItemCount() - 1)) { if (m_sptList.GetCheck(iIndex++)) { bIsSelect = true; break; } } UpdateData(TRUE); if (true != bIsSelect) { szCaption.Empty(); szCaption.LoadString(IDS_OP_DC_SCON_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(); } BOOL COpCreateSFDlg::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); } void COpCreateSFDlg::OnCancel() { // TODO: Add extra cleanup here AfxGetMainWnd()->EnableWindow(); *m_pRet = RET_CANCEL; CDialog::OnCancel(); } BOOL COpCreateSFDlg::DestroyWindow() { // TODO: Add your specialized code here and/or call the base class OnCancel(); return CDialog::DestroyWindow(); } BOOL COpCreateSFDlg::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); }