// Util9111Dlg.cpp : implementation file // #include "stdafx.h" #include "Util9111.h" #include "Util9111Dlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif CRect plotRect0, plotRect1; // 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() // CUtil9111Dlg dialog CUtil9111Dlg::CUtil9111Dlg(I16 hCard, U16 wCardType, CWnd* pParent /*=NULL*/) : CDialog(CUtil9111Dlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_hCard = hCard; m_wCardType = wCardType; n_PlotWidth = n_PlotHeight = -1; OnBrush = OffBrush = NULL; min_val = 0x00; max_val = 0xFFFF; for( int i=0; iAppendMenu(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 x_divider = 5; y_divider = 2; OnBrush = CreateSolidBrush( RGB(255,0,0) ); OffBrush = CreateSolidBrush( RGB(125,0,0) ); RedPen.CreatePen( PS_SOLID, 1, RGB(255,0,0)); GreenPen.CreatePen( PS_SOLID, 1, RGB(0,255,0)); YellowPen.CreatePen( PS_SOLID, 1, RGB(255,255,0)); BluePen.CreatePen( PS_SOLID, 1, RGB(0,0,255)); LTBluePen.CreatePen( PS_SOLID, 1, RGB(0,128,255)); LTRedPen.CreatePen( PS_SOLID, 1, RGB(255,128,0)); LTGreenPen.CreatePen( PS_SOLID, 1, RGB(0,128,0)); WhitePen.CreatePen( PS_SOLID, 1, RGB(255,255,255)); if( n_PlotWidth == -1 && n_PlotHeight == -1 ) { ((CWnd*)GetDlgItem(IDC_STATIC_DRAW0))->GetWindowRect(&plotRect0); ScreenToClient(&plotRect0); n_PlotWidth = min( plotRect0.Width(), 512); n_PlotHeight = plotRect0.Height(); ((CWnd*)GetDlgItem(IDC_STATIC_DRAW1))->GetWindowRect(&plotRect1); ScreenToClient(&plotRect1); } // TODO: Add extra initialization here info.cbSize = sizeof(SCROLLINFO); info.fMask = SIF_ALL; info.nMin = 0; info.nMax = 4095; info.nPage = 2; info.nPos = 0; info.nTrackPos = 2; m_scBarAO.SetScrollInfo(&info); m_nAOValue = 0; m_cbAIRange.SetCurSel( 1 ); max_range = 5.0; min_range = -5.0; m_wAdRange = AD_B_5_V; m_nTimer = SetTimer( 1, 100, NULL ); return TRUE; // return TRUE unless you set the focus to a control } void CUtil9111Dlg::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 CUtil9111Dlg::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 { redraw_display_area(); CDialog::OnPaint(); } } // The system calls this function to obtain the cursor to display while the user drags // the minimized window. HCURSOR CUtil9111Dlg::OnQueryDragIcon() { return static_cast(m_hIcon); } void CUtil9111Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: Add your message handler code here and/or call default int minpos; int maxpos; double fAOValue; CString strTmp; m_scBarAO.GetScrollRange(&minpos, &maxpos); maxpos = m_scBarAO.GetScrollLimit(); // Get the current position of scroll box. int curpos = m_scBarAO.GetScrollPos(); // Determine the new position of scroll box. switch (nSBCode) { case SB_LINELEFT: // Scroll left. if (curpos > minpos) curpos--; break; case SB_LINERIGHT: // Scroll right. if (curpos < maxpos) curpos++; break; case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position curpos = nPos; // of the scroll box at the end of the drag operation. break; case SB_LEFT: // Scroll to far left. case SB_RIGHT: // Scroll to far right. case SB_ENDSCROLL: // End scroll. case SB_PAGELEFT: // Scroll one page left. case SB_PAGERIGHT: // Scroll one page right. case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the break; } // Set the new position of the thumb (scroll box). m_scBarAO.SetScrollPos(curpos); if( m_nAOValue != curpos ) { // update the m_nAOValue value, and output AO m_nAOValue = curpos; fAOValue = ( 20.0 * (double)curpos / (double)(maxpos - minpos) ) - 10.0; strTmp.Format( TEXT("%.02f"), fAOValue ); SetDlgItemText( IDC_EDIT_AO, strTmp ); AO_WriteChannel(m_hCard, 0, curpos); } CDialog::OnHScroll(nSBCode, nPos, pScrollBar); } void CUtil9111Dlg::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here if( m_nTimer != -1 ) { KillTimer( m_nTimer ); m_nTimer = -1; } if( OnBrush != NULL ) ::DeleteObject( OnBrush ); if( OffBrush != NULL ) ::DeleteObject( OffBrush ); RedPen.DeleteObject(); GreenPen.DeleteObject(); YellowPen.DeleteObject(); BluePen.DeleteObject(); LTBluePen.DeleteObject(); LTRedPen.DeleteObject(); LTGreenPen.DeleteObject(); WhitePen.DeleteObject(); } void CUtil9111Dlg::OnAIRangeSelchange() { // TODO: Add your control notification handler code here U16 tmpAdRange; int nIndex; double maxRange, minRange; nIndex = m_cbAIRange.GetCurSel(); switch( nIndex ) { case 0: tmpAdRange = AD_B_10_V; maxRange = 10.0; minRange = -10.0; break; case 1: tmpAdRange = AD_B_5_V; maxRange = 5.0; minRange = -5.0; break; case 2: tmpAdRange = AD_B_2_5_V; maxRange = 2.5; minRange = -2.5; break; case 3: tmpAdRange = AD_B_1_25_V; maxRange = 1.25; minRange = -1.25; break; case 4: tmpAdRange = AD_B_0_625_V; maxRange = 0.625; minRange = -0.625; break; } if( tmpAdRange != m_wAdRange ) { // update m_InPortA and configure the target Port m_wAdRange = tmpAdRange; max_range = maxRange; min_range = minRange; redraw_display_area(); } } void CUtil9111Dlg::OnAI00Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH0 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[0] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[0] = 0x00; } } void CUtil9111Dlg::OnAI01Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH1 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[1] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[1] = 0x00; } } void CUtil9111Dlg::OnAI02Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH2 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[2] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[2] = 0x00; } } void CUtil9111Dlg::OnAI03Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH3 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[3] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[3] = 0x00; } } void CUtil9111Dlg::OnAI04Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH4 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[4] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[4] = 0x00; } } void CUtil9111Dlg::OnAI05Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH5 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[5] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[5] = 0x00; } } void CUtil9111Dlg::OnAI06Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH6 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[6] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[6] = 0x00; } } void CUtil9111Dlg::OnAI07Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH7 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[7] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[7] = 0x00; } } void CUtil9111Dlg::OnAI08Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH8 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[8] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[8] = 0x00; } } void CUtil9111Dlg::OnAI09Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH9 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[9] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[9] = 0x00; } } void CUtil9111Dlg::OnAI10Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH10 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[10] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[10] = 0x00; } } void CUtil9111Dlg::OnAI11Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH11 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[11] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[11] = 0x00; } } void CUtil9111Dlg::OnAI12Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH12 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[12] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[12] = 0x00; } } void CUtil9111Dlg::OnAI13Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH13 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[13] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[13] = 0x00; } } void CUtil9111Dlg::OnAI14Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH14 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[14] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[14] = 0x00; } } void CUtil9111Dlg::OnAI15Enable() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH15 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_AIEnable[15] = 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_AIEnable[15] = 0x00; } } void CUtil9111Dlg::OnDo00() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO00 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x01; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x01); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo01() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO01 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x02; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x02); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo02() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO02 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x04; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x04); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo03() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO03 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x08; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x08); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo04() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO04 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x10; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x10); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo05() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO05 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x20; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x20); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo06() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO06 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x40; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x40); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo07() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO07 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x80; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x80); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo08() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO08 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x100; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x100); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo09() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO09 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x200; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x200); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo10() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO10 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x400; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x400); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo11() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO11 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x800; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x800); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo12() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO12 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x1000; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x1000); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo13() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO13 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x2000; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x2000); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo14() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO14 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x4000; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x4000); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnDo15() { // TODO: Add your control notification handler code here int CheckSts; CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_DO15 ))->GetCheck(); if( CheckSts == BST_CHECKED ) { m_OutData |= 0x8000; } else if( CheckSts == BST_UNCHECKED ) { m_OutData &= (~0x8000); } DO_WritePort(m_hCard, 0, m_OutData); } void CUtil9111Dlg::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default U32 dwPortData,dwChangeMask; I16 err; err = DI_ReadPort(m_hCard, P9111_CHANNEL_DI, &dwPortData); dwChangeMask = dwPortData ^ m_InData; if( dwChangeMask != 0x00 ) // Input had been changed { m_InData = dwPortData; if( (dwChangeMask & 0x0001) == 0x0001 ) // if the target bit is changed { if( (dwPortData & 0x0001) == 0x0001 ) { m_Icon_IN00.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN00.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0002) == 0x0002 ) // if the target bit is changed { if( (dwPortData & 0x0002) == 0x0002 ) { m_Icon_IN01.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN01.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0004) == 0x0004 ) // if the target bit is changed { if( (dwPortData & 0x0004) == 0x0004 ) { m_Icon_IN02.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN02.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0008) == 0x0008 ) // if the target bit is changed { if( (dwPortData & 0x0008) == 0x0008 ) { m_Icon_IN03.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN03.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0010) == 0x0010 ) // if the target bit is changed { if( (dwPortData & 0x0010) == 0x0010 ) { m_Icon_IN04.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN04.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0020) == 0x0020 ) // if the target bit is changed { if( (dwPortData & 0x0020) == 0x0020 ) { m_Icon_IN05.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN05.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0040) == 0x0040 ) // if the target bit is changed { if( (dwPortData & 0x0040) == 0x0040 ) { m_Icon_IN06.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN06.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0080) == 0x0080 ) // if the target bit is changed { if( (dwPortData & 0x0080) == 0x0080 ) { m_Icon_IN07.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN07.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0100) == 0x0100 ) // if the target bit is changed { if( (dwPortData & 0x0100) == 0x0100 ) { m_Icon_IN08.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN08.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0200) == 0x0200 ) // if the target bit is changed { if( (dwPortData & 0x0200) == 0x0200 ) { m_Icon_IN09.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN09.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0400) == 0x0400 ) // if the target bit is changed { if( (dwPortData & 0x0400) == 0x0400 ) { m_Icon_IN10.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN10.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x0800) == 0x0800 ) // if the target bit is changed { if( (dwPortData & 0x0800) == 0x0800 ) { m_Icon_IN11.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN11.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x1000) == 0x1000 ) // if the target bit is changed { if( (dwPortData & 0x1000) == 0x1000 ) { m_Icon_IN12.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN12.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x2000) == 0x2000 ) // if the target bit is changed { if( (dwPortData & 0x2000) == 0x2000 ) { m_Icon_IN13.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN13.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x4000) == 0x4000 ) // if the target bit is changed { if( (dwPortData & 0x4000) == 0x4000 ) { m_Icon_IN14.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN14.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } if( (dwChangeMask & 0x8000) == 0x8000 ) // if the target bit is changed { if( (dwPortData & 0x8000) == 0x8000 ) { m_Icon_IN15.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ; } else { m_Icon_IN15.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ; } } } for( int i=0; i> 4; newY = (int)( nDraw_Bottom - ((n_PlotHeight * ai_data) >> 12 ) ); // (n_PlotHeight * ai_data / 4096 ) ); // ( (n_PlotHeight/2) * ai_data/2048 ) ); } else // m_wCardType == PCI_9111HR { ai_data = (I16)(m_AIData[i]); newY = (int)( nDraw_Bottom - ((n_PlotHeight * ai_data) >> 16) ); // ( n_PlotHeight * ai_data / 65536) ); // ( (n_PlotHeight/2) * ai_data/32768 ) ); } if ( m_oldY[i] !=-1 ) { if( i < 8 ) { dc_plot.MoveTo( plotRect0.left+2, newY ); dc_plot.LineTo( plotRect0.left+5, m_oldY[i] ); } else { dc_plot.MoveTo( plotRect1.left+2, newY ); dc_plot.LineTo( plotRect1.left+5, m_oldY[i] ); } } m_oldY[i] = newY; } } return 0; }