// Util7348Dlg.cpp : implementation file // #include "stdafx.h" #include "Util7348.h" #include "Util7348Dlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) END_MESSAGE_MAP() // CUtil7348Dlg dialog CUtil7348Dlg::CUtil7348Dlg(I16 hCard, CWnd* pParent /*=NULL*/) : CDialog(CUtil7348Dlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_InPortA = Channel_P1A; m_OutPortA = Channel_P2A; m_InPortB = Channel_P1B; m_OutPortB = Channel_P2B; m_InPortC = Channel_P1C; m_OutPortC = Channel_P2C; m_InDataPortA = 0x00; m_OutDataPortA = 0x00; m_InDataPortB = 0x00; m_OutDataPortB = 0x00; m_InDataPortC = 0x00; m_OutDataPortC = 0x00; m_hCard = hCard; m_nTimer = -1; } void CUtil7348Dlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_ICON_PC0, m_Icon_PC0); DDX_Control(pDX, IDC_ICON_PC1, m_Icon_PC1); DDX_Control(pDX, IDC_ICON_PC2, m_Icon_PC2); DDX_Control(pDX, IDC_ICON_PC3, m_Icon_PC3); DDX_Control(pDX, IDC_ICON_PC4, m_Icon_PC4); DDX_Control(pDX, IDC_ICON_PC5, m_Icon_PC5); DDX_Control(pDX, IDC_ICON_PC6, m_Icon_PC6); DDX_Control(pDX, IDC_ICON_PC7, m_Icon_PC7); DDX_Control(pDX, IDC_ICON_PB0, m_Icon_PB0); DDX_Control(pDX, IDC_ICON_PB1, m_Icon_PB1); DDX_Control(pDX, IDC_ICON_PB2, m_Icon_PB2); DDX_Control(pDX, IDC_ICON_PB3, m_Icon_PB3); DDX_Control(pDX, IDC_ICON_PB4, m_Icon_PB4); DDX_Control(pDX, IDC_ICON_PB5, m_Icon_PB5); DDX_Control(pDX, IDC_ICON_PB6, m_Icon_PB6); DDX_Control(pDX, IDC_ICON_PB7, m_Icon_PB7); DDX_Control(pDX, IDC_ICON_PA0, m_Icon_PA0); DDX_Control(pDX, IDC_ICON_PA1, m_Icon_PA1); DDX_Control(pDX, IDC_ICON_PA2, m_Icon_PA2); DDX_Control(pDX, IDC_ICON_PA3, m_Icon_PA3); DDX_Control(pDX, IDC_ICON_PA4, m_Icon_PA4); DDX_Control(pDX, IDC_ICON_PA5, m_Icon_PA5); DDX_Control(pDX, IDC_ICON_PA6, m_Icon_PA6); DDX_Control(pDX, IDC_ICON_PA7, m_Icon_PA7); DDX_Control(pDX, IDC_COMBO_IN_PA, m_cbPortAIn); DDX_Control(pDX, IDC_COMBO_IN_PB, m_cbPortBIn); DDX_Control(pDX, IDC_COMBO_IN_PCL, m_cbPortCIn); DDX_Control(pDX, IDC_COMBO_OUT_PA, m_cbPortAOut); DDX_Control(pDX, IDC_COMBO_OUT_PB, m_cbPortBOut); DDX_Control(pDX, IDC_COMBO_OUT_PCL, m_cbPortCOut); } BEGIN_MESSAGE_MAP(CUtil7348Dlg, CDialog) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_CBN_SELCHANGE(IDC_COMBO_IN_PA, &CUtil7348Dlg::OnInPASelchange) ON_CBN_SELCHANGE(IDC_COMBO_OUT_PA, &CUtil7348Dlg::OnOutPASelchange) ON_CBN_SELCHANGE(IDC_COMBO_IN_PB, &CUtil7348Dlg::OnInPBSelchange) ON_CBN_SELCHANGE(IDC_COMBO_OUT_PB, &CUtil7348Dlg::OnOutPBSelchange) ON_CBN_SELCHANGE(IDC_COMBO_IN_PCL, &CUtil7348Dlg::OnInPCLSelchange) ON_CBN_SELCHANGE(IDC_COMBO_OUT_PCL, &CUtil7348Dlg::OnOutPCLSelchange) ON_WM_DESTROY() ON_WM_TIMER() ON_BN_CLICKED(IDC_CHECK_PC0, &CUtil7348Dlg::OnOutputPC0) ON_BN_CLICKED(IDC_CHECK_PC1, &CUtil7348Dlg::OnOutputPC1) ON_BN_CLICKED(IDC_CHECK_PC2, &CUtil7348Dlg::OnOutputPC2) ON_BN_CLICKED(IDC_CHECK_PC3, &CUtil7348Dlg::OnOutputPC3) ON_BN_CLICKED(IDC_CHECK_PC4, &CUtil7348Dlg::OnOutputPC4) ON_BN_CLICKED(IDC_CHECK_PC5, &CUtil7348Dlg::OnOutputPC5) ON_BN_CLICKED(IDC_CHECK_PC6, &CUtil7348Dlg::OnOutputPC6) ON_BN_CLICKED(IDC_CHECK_PC7, &CUtil7348Dlg::OnOutputPC7) ON_BN_CLICKED(IDC_CHECK_PB0, &CUtil7348Dlg::OnOutputPB0) ON_BN_CLICKED(IDC_CHECK_PB1, &CUtil7348Dlg::OnOutputPB1) ON_BN_CLICKED(IDC_CHECK_PB2, &CUtil7348Dlg::OnOutputPB2) ON_BN_CLICKED(IDC_CHECK_PB3, &CUtil7348Dlg::OnOutputPB3) ON_BN_CLICKED(IDC_CHECK_PB4, &CUtil7348Dlg::OnOutputPB4) ON_BN_CLICKED(IDC_CHECK_PB5, &CUtil7348Dlg::OnOutputPB5) ON_BN_CLICKED(IDC_CHECK_PB6, &CUtil7348Dlg::OnOutputPB6) ON_BN_CLICKED(IDC_CHECK_PB7, &CUtil7348Dlg::OnOutputPB7) ON_BN_CLICKED(IDC_CHECK_PA0, &CUtil7348Dlg::OnOutputPA0) ON_BN_CLICKED(IDC_CHECK_PA1, &CUtil7348Dlg::OnOutputPA1) ON_BN_CLICKED(IDC_CHECK_PA2, &CUtil7348Dlg::OnOutputPA2) ON_BN_CLICKED(IDC_CHECK_PA3, &CUtil7348Dlg::OnOutputPA3) ON_BN_CLICKED(IDC_CHECK_PA4, &CUtil7348Dlg::OnOutputPA4) ON_BN_CLICKED(IDC_CHECK_PA5, &CUtil7348Dlg::OnOutputPA5) ON_BN_CLICKED(IDC_CHECK_PA6, &CUtil7348Dlg::OnOutputPA6) ON_BN_CLICKED(IDC_CHECK_PA7, &CUtil7348Dlg::OnOutputPA7) ON_WM_CTLCOLOR() END_MESSAGE_MAP() // CUtil7348Dlg message handlers BOOL CUtil7348Dlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { BOOL bNameValid; CString strAboutMenu; bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); ASSERT(bNameValid); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here m_cbPortAIn.SetCurSel(0); m_cbPortBIn.SetCurSel(0); m_cbPortCIn.SetCurSel(0); m_cbPortAOut.SetCurSel(1); m_cbPortBOut.SetCurSel(1); m_cbPortCOut.SetCurSel(1); // Port Configuration DIO_PortConfig(m_hCard, m_InPortA, INPUT_PORT); DIO_PortConfig(m_hCard, m_OutPortA, OUTPUT_PORT); DIO_PortConfig(m_hCard, m_InPortB, INPUT_PORT); DIO_PortConfig(m_hCard, m_OutPortB, OUTPUT_PORT); DIO_PortConfig(m_hCard, m_InPortC, INPUT_PORT); DIO_PortConfig(m_hCard, m_OutPortC, OUTPUT_PORT); DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); m_nTimer = SetTimer( 1, 50, NULL ); return TRUE; // return TRUE unless you set the focus to a control } void CUtil7348Dlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CUtil7348Dlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this function to obtain the cursor to display while the user drags // the minimized window. HCURSOR CUtil7348Dlg::OnQueryDragIcon() { return static_cast(m_hIcon); } void CUtil7348Dlg::OnInPASelchange() { // TODO: Add your control notification handler code here U16 tmpInPA; int nIndex; nIndex = m_cbPortAIn.GetCurSel(); switch( nIndex ) { case 0: tmpInPA = Channel_P1A; break; case 1: tmpInPA = Channel_P2A; break; } m_InPortA = tmpInPA; DIO_PortConfig(m_hCard, m_InPortA, INPUT_PORT); } void CUtil7348Dlg::OnOutPASelchange() { // TODO: Add your control notification handler code here U16 tmpOutPA; int nIndex; nIndex = m_cbPortAOut.GetCurSel(); switch( nIndex ) { case 0: tmpOutPA = Channel_P1A; break; case 1: tmpOutPA = Channel_P2A; break; } m_OutPortA = tmpOutPA; DIO_PortConfig(m_hCard, m_OutPortA, OUTPUT_PORT); // reset Output data m_OutDataPortA = 0x00; } void CUtil7348Dlg::OnInPBSelchange() { // TODO: Add your control notification handler code here U16 tmpInPB; int nIndex; nIndex = m_cbPortBIn.GetCurSel(); switch( nIndex ) { case 0: tmpInPB = Channel_P1B; break; case 1: tmpInPB = Channel_P2B; break; } m_InPortB = tmpInPB; DIO_PortConfig(m_hCard, m_InPortB, INPUT_PORT); } void CUtil7348Dlg::OnOutPBSelchange() { // TODO: Add your control notification handler code here U16 tmpOutPB; int nIndex; nIndex = m_cbPortBOut.GetCurSel(); switch( nIndex ) { case 0: tmpOutPB = Channel_P1B; break; case 1: tmpOutPB = Channel_P2B; break; } m_OutPortB = tmpOutPB; DIO_PortConfig(m_hCard, m_OutPortB, OUTPUT_PORT); // reset Output data m_OutDataPortB = 0x00; } void CUtil7348Dlg::OnInPCLSelchange() { // TODO: Add your control notification handler code here U16 tmpInPC; int nIndex; nIndex = m_cbPortCIn.GetCurSel(); switch( nIndex ) { case 0: tmpInPC = Channel_P1C; break; case 1: tmpInPC = Channel_P2C; break; } m_InPortC = tmpInPC; DIO_PortConfig(m_hCard, m_InPortC, INPUT_PORT); } void CUtil7348Dlg::OnOutPCLSelchange() { // TODO: Add your control notification handler code here U16 tmpOutPC; int nIndex; nIndex = m_cbPortCOut.GetCurSel(); switch( nIndex ) { case 0: tmpOutPC = Channel_P1C; break; case 1: tmpOutPC = Channel_P2C; break; } m_OutPortC = tmpOutPC; DIO_PortConfig(m_hCard, m_OutPortC, OUTPUT_PORT); // reset Output data m_OutDataPortC = 0x00; } void CUtil7348Dlg::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here if( m_nTimer != -1 ) { KillTimer( m_nTimer ); m_nTimer = -1; } } void CUtil7348Dlg::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default U32 dwPortData,dwChangeMask; // process the InData of PortA DI_ReadPort( m_hCard, m_InPortA, &dwPortData); dwChangeMask = dwPortData ^ m_InDataPortA; if( dwChangeMask != 0x00 ) // Input had been changed { m_InDataPortA = dwPortData; if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed { if( (dwPortData & 0x01) == 0x01 ) { m_Icon_PA0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed { if( (dwPortData & 0x02) == 0x02 ) { m_Icon_PA1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed { if( (dwPortData & 0x04) == 0x04 ) { m_Icon_PA2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed { if( (dwPortData & 0x08) == 0x08 ) { m_Icon_PA3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x10) == 0x10 ) // if the target bit is changed { if( (dwPortData & 0x10) == 0x10 ) { m_Icon_PA4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x20) == 0x20 ) // if the target bit is changed { if( (dwPortData & 0x20) == 0x20 ) { m_Icon_PA5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x40) == 0x40 ) // if the target bit is changed { if( (dwPortData & 0x40) == 0x40 ) { m_Icon_PA6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x80) == 0x80 ) // if the target bit is changed { if( (dwPortData & 0x80) == 0x80 ) { m_Icon_PA7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PA7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } } // process the InData of PortB DI_ReadPort( m_hCard, m_InPortB, &dwPortData); dwChangeMask = dwPortData ^ m_InDataPortB; if( dwChangeMask != 0x00 ) // Input had been changed { m_InDataPortB = dwPortData; if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed { if( (dwPortData & 0x01) == 0x01 ) { m_Icon_PB0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed { if( (dwPortData & 0x02) == 0x02 ) { m_Icon_PB1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed { if( (dwPortData & 0x04) == 0x04 ) { m_Icon_PB2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed { if( (dwPortData & 0x08) == 0x08 ) { m_Icon_PB3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x10) == 0x10 ) // if the target bit is changed { if( (dwPortData & 0x10) == 0x10 ) { m_Icon_PB4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x20) == 0x20 ) // if the target bit is changed { if( (dwPortData & 0x20) == 0x20 ) { m_Icon_PB5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x40) == 0x40 ) // if the target bit is changed { if( (dwPortData & 0x40) == 0x40 ) { m_Icon_PB6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x80) == 0x80 ) // if the target bit is changed { if( (dwPortData & 0x80) == 0x80 ) { m_Icon_PB7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PB7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } } // process the InData of PortC Lower DI_ReadPort( m_hCard, m_InPortC, &dwPortData); dwChangeMask = dwPortData ^ m_InDataPortC; if( dwChangeMask != 0x00 ) // Input had been changed { m_InDataPortC = dwPortData; if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed { if( (dwPortData & 0x01) == 0x01 ) { m_Icon_PC0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed { if( (dwPortData & 0x02) == 0x02 ) { m_Icon_PC1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed { if( (dwPortData & 0x04) == 0x04 ) { m_Icon_PC2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed { if( (dwPortData & 0x08) == 0x08 ) { m_Icon_PC3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x10) == 0x10 ) // if the target bit is changed { if( (dwPortData & 0x10) == 0x10 ) { m_Icon_PC4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x20) == 0x20 ) // if the target bit is changed { if( (dwPortData & 0x20) == 0x20 ) { m_Icon_PC5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x40) == 0x40 ) // if the target bit is changed { if( (dwPortData & 0x40) == 0x40 ) { m_Icon_PC6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x80) == 0x80 ) // if the target bit is changed { if( (dwPortData & 0x80) == 0x80 ) { m_Icon_PC7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_PC7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } } CDialog::OnTimer(nIDEvent); } void CUtil7348Dlg::OnOutputPC0() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC0 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x01); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC1() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC1 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x02; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x02); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC2() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC2 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x04; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x04); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC3() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC3 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x08; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x08); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC4() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC4 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x10; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x10); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC5() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC5 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x20; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x20); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC6() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC6 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x40; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x40); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPC7() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC7 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortC |= 0x80; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortC &= (~0x80); } DO_WritePort( m_hCard, m_OutPortC, m_OutDataPortC ); } void CUtil7348Dlg::OnOutputPB0() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB0 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x01); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB1() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB1 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x02; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x02); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB2() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB2 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x04; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x04); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB3() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB3 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x08; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x08); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB4() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB4 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x10; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x10); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB5() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB5 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x20; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x20); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB6() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB6 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x40; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x40); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPB7() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB7 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortB |= 0x80; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortB &= (~0x80); } DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB ); } void CUtil7348Dlg::OnOutputPA0() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA0 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x01); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA1() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA1 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x02; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x02); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA2() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA2 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x04; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x04); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA3() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA3 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x08; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x08); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA4() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA4 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x10; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x10); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA5() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA5 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x20; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x20); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA6() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA6 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x40; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x40); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } void CUtil7348Dlg::OnOutputPA7() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA7 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutDataPortA |= 0x80; } else if( CheckSts == BST_UNCHECKED ) { m_OutDataPortA &= (~0x80); } DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA ); } HBRUSH CUtil7348Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if ( pWnd->GetDlgCtrlID() == IDC_LABEL_INPUT2 ) pDC->SetTextColor(RGB(255,0,0)); if ( pWnd->GetDlgCtrlID() == IDC_LABEL_OUTPUT ) pDC->SetTextColor(RGB(255,0,0)); // TODO: Return a different brush if the default is not desired return hbr; }