//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: OptionsDlg.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of OptionsDlg.cpp //---------------------------------------------------------------------------- // OptionsDlg.cpp : implementation file // #include "stdafx.h" #include "Calibration.h" #include "OptionsDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // COptionsDlg dialog COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/) : CDialog(COptionsDlg::IDD, pParent) { //{{AFX_DATA_INIT(COptionsDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void COptionsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COptionsDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COptionsDlg, CDialog) //{{AFX_MSG_MAP(COptionsDlg) ON_BN_CLICKED(IDAPPLY, OnApply) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COptionsDlg message handlers BOOL COptionsDlg::OnInitDialog() { CDialog::OnInitDialog(); DWORD cbNeeded, cReturned; ::EnumPorts( NULL, 1, NULL, 0UL, &cbNeeded, &cReturned ); LPPORT_INFO_1 pPI = (LPPORT_INFO_1)new BYTE[ cbNeeded ]; ::EnumPorts( NULL, 1, (LPBYTE)pPI, cbNeeded, &cbNeeded, &cReturned ); for( DWORD i = 0; i < cReturned; i++ ) { ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, CB_ADDSTRING, 0, (LONG)pPI[i].pName ); ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, CB_ADDSTRING, 0, (LONG)pPI[i].pName ); } ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, CB_SELECTSTRING, -1, (LONG)(LPCTSTR)m_pData->strCameraPortName ); ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, CB_SELECTSTRING, -1, (LONG)(LPCTSTR)m_pData->strLgsPortName ); delete pPI; return TRUE; } void COptionsDlg::SetData(OPTIONS *pData) { m_pData = pData; } void COptionsDlg::OnApply() { TCHAR pText[MAX_PATH]; ::SendDlgItemMessage( m_hWnd, IDC_COMBO_LGS_PORT, WM_GETTEXT, MAX_PATH, (LONG)pText ); m_pData->strLgsPortName = pText; ::SendDlgItemMessage( m_hWnd, IDC_COMBO_CAMERA_PORT, WM_GETTEXT, MAX_PATH, (LONG)pText ); m_pData->strCameraPortName = pText; GetParent()->SendMessage( WM_OPTIONS_CHANGED ); }