void CGioOutputDlg::UpdateIO() 
{
	UINT32 output = 0;
	UINT32 state = 0;
   UINT32 capReadOnly = 0;
	BOOL status;

	if (m_pGio->IsParameterValid(CORGIO_PRM_DIR_OUTPUT))
		status = m_pGio->GetParameter(CORGIO_PRM_DIR_OUTPUT,&output);

   if( m_pGio->IsCapabilityValid(CORGIO_CAP_READ_ONLY))
      status = m_pGio->GetCapability(CORGIO_CAP_READ_ONLY, &capReadOnly);

	for (UINT32 iIO=0; iIO < (UINT32)m_pGio->GetNumPins(); iIO++)
	{
		CString caption;
		CButton * pinButton = (CButton*)GetDlgItem(IDC_SCG_PIN1 + iIO);
		pinButton->GetWindowText(caption);
		if( caption.CompareNoCase(_T("HIGH")) == 0)
			 state = 1;
		 else
			 state = 0;
		
      if( !(capReadOnly & (1 << iIO)))
      {
         status = m_pGio->SetPinState(iIO, (SapGio::PinState)state);
      }
	}
}
void CBusEventHandlerDlg::OnBnClickedOk()
{
    CButton* pomButton       = NULL;
    CString omStrHandlerName = STR_EMPTY ;
    CString omStrControl     = STR_EMPTY ;
    INT nCheck               = 0;
    BOOL bIsEnable           = TRUE;
    // Get the selected handlers either for deleteting or adding and
    // add the name in the array
    for(int j=0; j<defBUSEV_HANDLER_NUMBER; j++)
    {
        pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER + j);
        if(pomButton != NULL )
        {
            nCheck      = pomButton->GetCheck();
            bIsEnable   = pomButton->IsWindowEnabled();
            pomButton->GetWindowText(omStrControl);
            omStrControl.TrimLeft();
            omStrControl.TrimRight();
            omStrControl.Replace(' ','_');
            omStrControl.Replace('-','_');
            omStrHandlerName = omStrControl;
            if(nCheck == 1 && bIsEnable != 0 )
            {
                m_omStrArrayBusEventHandler.Add(omStrHandlerName);
            }
        }
    }
    OnOK();
}
Esempio n. 3
0
void CErrHandlerDlg::OnCbtnErrorOk() 
{
    CButton* pomButton       = NULL;
    CString omStrHandlerName = STR_EMPTY ;
    CString omStrControl     = STR_EMPTY ;
    INT nCheck               = 0;
    BOOL bIsEnable           = TRUE;
    // Get the selected handlers either for deleteting or adding and
    // add the name in the array
    for(int j=0; j<defERROR_HANDLER_NUMBER; j++)
    {
        pomButton = 
        (CButton*)GetDlgItem(IDC_CHKB_ERROR_ACTIVE_HANDLER + j);
        if(pomButton != NULL )
        {
            nCheck      = pomButton->GetCheck();
            bIsEnable   = pomButton->IsWindowEnabled();
            pomButton->GetWindowText(omStrControl);
            omStrControl.Replace(_T("Error"),_T(""));
            omStrControl.TrimLeft();
            omStrControl.TrimRight();
            omStrControl.Replace(' ','_');
            omStrHandlerName = omStrControl;
            if(nCheck == 1 && bIsEnable != 0 )
            {
                m_omStrArrayErrorHandler.Add(omStrHandlerName);
            }
       }
    }
    CDialog::OnOK();
}
Esempio n. 4
0
void NetCfg::TurnRun()
{
	CButton *hButton;
	CString strout;
	CString str_start = "传输";
	HWND hparent;

	hparent = this->GetParent()->GetSafeHwnd();
	hButton = (CButton *)GetDlgItem(IDC_BTN_TRANSFER);
	hButton->GetWindowText(strout);

	// todo 检查文件是否存在
	// 文件不存在,退出
	if (0) {
		return  ;
	}
	
	hButton->SetWindowText("传输");
	GetDlgItem(IDC_EDIT_BROWSE)->EnableWindow(TRUE);
	GetDlgItem(IDC_BTN_BROWSE)->EnableWindow(TRUE);
	GetDlgItem(IDC_EDIT_TICK)->EnableWindow(TRUE);
	GetDlgItem(IDC_COMBO_TICK)->EnableWindow(TRUE);
	::SendNotifyMessage(hparent,UM_DO_PAUSE_TRANSFER,NULL,NULL);  

}
Esempio n. 5
0
// 按下“启动”/“停止”按钮,发消息到父窗体
void NetCfg::OnBnClickedBtnStart()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton *hButton;
	CString strout;
	CString str_start = "启动";
	HWND hparent;

	hparent = this->GetParent()->GetSafeHwnd();
	hButton = (CButton *)GetDlgItem(IDC_BTN_START);
	hButton->GetWindowText(strout);
	if (strout == str_start) {
		
		hButton->SetWindowText("停止");
		GetDlgItem(IDC_IP_TARGET)->EnableWindow(FALSE);
		GetDlgItem(IDC_COMBO_THREAD)->EnableWindow(FALSE);
		GetDlgItem(IDC_BTN_TRANSFER)->EnableWindow(TRUE);
		::SendNotifyMessage(hparent,UM_DO_RUN_THREAD,NULL,NULL);  
		
	}
	else {
		TurnRun();
		hButton->SetWindowText("启动");
		GetDlgItem(IDC_IP_TARGET)->EnableWindow(TRUE);
		GetDlgItem(IDC_COMBO_THREAD)->EnableWindow(TRUE);
		GetDlgItem(IDC_BTN_TRANSFER)->EnableWindow(FALSE);

// 		GetDlgItem(IDC_EDIT_BROWSE)->EnableWindow(TRUE);
// 		GetDlgItem(IDC_BTN_BROWSE)->EnableWindow(TRUE);
// 		GetDlgItem(IDC_EDIT_TICK)->EnableWindow(TRUE);
		::SendNotifyMessage(hparent,UM_DO_STOP_THREAD,NULL,NULL);  
	}
	
}
Esempio n. 6
0
// カメラ開始
void COpenCVStitch2013Dlg::DoOpen()
{
	//if (fileOpened)
	//{
	//	return;
	//}
	camera.clear();
	for (int id = IDC_CAM1; id <= IDC_CAM4; id++)
	{
		CButton *item = (CButton*)GetDlgItem(id);
		if (item->GetCheck() == BST_CHECKED)
		{
			WCHAR	wname[80];
			char name[80];// , buffer[100];
			size_t len;
			bool res;
			item->GetWindowText(wname, 80);
			wcstombs_s(&len, name, 80, wname, 80);

			WebCam cam = WebCam();
			res = cam.open(id - IDC_CAM1);
			if (res) {
				CString buffer;
				res = cam.set(CV_CAP_PROP_FRAME_WIDTH, WIDTH);
				res = cam.set(CV_CAP_PROP_FRAME_HEIGHT, HEIGHT);
				buffer.Format(L"%d %s", id - IDC_CAM1 + 1, name);
				res = cam.set(CV_CAP_PROP_FPS, FPS);
				res = cam.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
				cam.SetName(name);
				camera.push_back(cam);
			}
		}
	}
}
Esempio n. 7
0
void CdynControlDlg::OnBtnClickLock(UINT id)
{
    int idx = id - LOCKBTN_ID_OFFSET;
    CButton *btn = (CButton*)GetDlgItem(id);
    CString str;
    btn->GetWindowText(str);

    if (str == _T("unlock")) {
        btn->SetWindowText(_T("lock"));
        log(_T("unlock 0x%02x\n"), idx);
        jointPositionUnlock(cmd, &cmdLen, idx);
        SendData(cmd, cmdLen);

    } else {
        btn->SetWindowText(_T("unlock"));
        log(_T("lock 0x%02x\n"), idx);
        jointPositionLock(cmd, &cmdLen, idx);
        SendData(cmd, cmdLen);
    }
}
Esempio n. 8
0
// 按下“传输”/“暂停”,通知父窗体
void NetCfg::OnBnClickedBtnTransfer()
{
	// TODO: 在此添加控件通知处理程序代码
	// TODO: 在此添加控件通知处理程序代码
	CButton *hButton;
	CString strout;
	CString str_start = "传输";
	HWND hparent;

	hparent = this->GetParent()->GetSafeHwnd();
	hButton = (CButton *)GetDlgItem(IDC_BTN_TRANSFER);
	hButton->GetWindowText(strout);

	// todo 检查文件是否存在
	// 文件不存在,退出
	if (0) {
		return  ;
	}

	if (strout == str_start) {
		TurnPause();
// 		hButton->SetWindowText("暂停");
// 		GetDlgItem(IDC_EDIT_BROWSE)->EnableWindow(FALSE);
// 		GetDlgItem(IDC_BTN_BROWSE)->EnableWindow(FALSE);
// 		GetDlgItem(IDC_EDIT_TICK)->EnableWindow(FALSE);
// 		::SendNotifyMessage(hparent,UM_DO_GO_TRANSFER,NULL,NULL);  

	}
	else {
		TurnRun();
// 		hButton->SetWindowText("传输");
// 		GetDlgItem(IDC_EDIT_BROWSE)->EnableWindow(TRUE);
// 		GetDlgItem(IDC_BTN_BROWSE)->EnableWindow(TRUE);
// 		GetDlgItem(IDC_EDIT_TICK)->EnableWindow(TRUE);
// 		::SendNotifyMessage(hparent,UM_DO_PAUSE_TRANSFER,NULL,NULL);  
	}
}
BOOL CBusEventHandlerDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    CStringArray* pomStrArrayHandlerName = NULL;
    CDialog::OnInitDialog();

    if( m_pDoc != NULL )
    {
        CButton* pomButton       = NULL;
        CString omStrHandlerName = STR_EMPTY ;
        CString omStrControl     = STR_EMPTY ;
        INT nCheck               = 0;
        // get the pointer to CStringArray of error handlers prototypes
        pomStrArrayHandlerName = m_pDoc->pomStrGetBusEventHandlerPrototypes();
        if(pomStrArrayHandlerName != NULL )
        {
            // Check for the handlers already added.
            for(INT  i = 0; i<defBUSEV_HANDLER_NUMBER; i++)
            {
                for(INT j =0; j<pomStrArrayHandlerName->GetSize(); j++)
                {
                    pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i);
                    if(pomButton != NULL )
                    {
                        omStrHandlerName = pomStrArrayHandlerName->GetAt(j);
                        pomButton->GetWindowText(omStrControl);
                        omStrControl.Replace(' ','_');
                        omStrControl.Replace('-','_');
                        // The find the control text in added handlers text
                        if( omStrHandlerName.Find(omStrControl) != -1 )
                        {
                            // If the dialog box is invoked for delete, check
                            // the box of already added handlers else check and
                            // disable
                            if(m_bIsDelete == TRUE )
                            {
                                pomButton->SetCheck(TRUE);
                            }
                            else
                            {
                                pomButton->SetCheck(TRUE);
                                pomButton->EnableWindow(FALSE);
                            }
                        }
                    }
                }
            }
        }
        // Disable all other check box corresponding to which the handlers
        // are not added and dialog box in invoked to delete the handlers
        if(m_bIsDelete == TRUE )
        {
            for(INT i = 0; i<defBUSEV_HANDLER_NUMBER; i++)
            {
                pomButton = (CButton*)GetDlgItem(IDC_CHKB_BUSEV_CONNECT_HANDLER+i);
                if(pomButton != NULL )
                {
                    nCheck = pomButton->GetCheck();
                    if(nCheck == 0 )
                    {
                        pomButton->EnableWindow(FALSE);
                    }
                }
            }
            // Set the dialog caption text to indicate user is deleting
            // the handlers
            SetWindowText(defBUSEV_HANDLER_TEXT_DEL);
        }
        else
        {
            // Set the dialog caption text to indicate user is adding
            // the handlers
            SetWindowText(defBUSEV_HANDLER_TEXT_ADD);
        }
    }
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 10
0
BOOL CErrHandlerDlg::OnInitDialog() 
{
    CStringArray* pomStrArrayHandlerName = NULL;

    CDialog::OnInitDialog();
    // remove all the element previously added, if any.
    m_omStrArrayErrorHandler.RemoveAll();
    // Get the pointer to document
    
    if( m_pDoc != NULL )
    {
        CButton* pomButton = NULL;
        CString omStrHandlerName = STR_EMPTY ;
        CString omStrControl     = STR_EMPTY ;
        INT nCheck               = 0;

        // get the pointer to CStringArray of error handlers prototypes
        pomStrArrayHandlerName = m_pDoc->pomStrGetErrorHandlerPrototypes();

        // Check for the handlers already added.
        int nIndex;     //nIndex declared outside
        for( nIndex = 0; nIndex < defERROR_HANDLER_NUMBER; nIndex++)
        {
            for(int j = 0; j < pomStrArrayHandlerName->GetSize(); j++)
            {
                pomButton = (CButton*)
                    GetDlgItem(IDC_CHKB_ERROR_ACTIVE_HANDLER + nIndex);
                if(pomButton != NULL )
                {
                    omStrHandlerName = pomStrArrayHandlerName->GetAt(j);
                    pomButton->GetWindowText(omStrControl);
                    omStrControl.Replace(' ','_');
                    // The find the control text in added handlers text
                    if( omStrHandlerName.Find(omStrControl) != -1 ) 
                    {
                        // If the dialog box is invoked for delete, check
                        // the box of already added handlers else check and
                        // disable
                        if(m_bIsDelete == TRUE )
                        {
                            pomButton->SetCheck(TRUE);
                        }
                        else
                        {
                            pomButton->SetCheck(TRUE);
                            pomButton->EnableWindow(FALSE);
                        }
                    }
                }
            }
        }

        // Disable all other check box corresponding to which the handlers 
        // are not added and dialog box in invoked to delete the handlers
        if(m_bIsDelete == TRUE )
        {
            for( nIndex = 0; nIndex < defERROR_HANDLER_NUMBER;
                nIndex++)
            {
                pomButton = (CButton*)
                    GetDlgItem(IDC_CHKB_ERROR_ACTIVE_HANDLER + nIndex);
                nCheck = pomButton->GetCheck();
                if(nCheck == 0 )
                {
                    pomButton->EnableWindow(FALSE);
                }
            }
            // Set the dialog caption text to indicate user is deleting 
            // the handlers
            SetWindowText(defERROR_HANDLER_TEXT_DEL);
        }
        else
        {
            // Set the dialog caption text to indicate user is adding 
            // the handlers
            SetWindowText(defERROR_HANDLER_TEXT_ADD);
        }
    }
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}