private void btnSendClock_Click(object sender, EventArgs e) { int ret = 0; m_nWidth = Convert.ToInt32(m_edtWidth.Text); m_nHeight = Convert.ToInt32(m_edtHeight.Text); if (1 == InitComm()) { if (0 == m_nCommType) { ret = CP5200.CP5200_RS232_SendClock(m_nCardID, 0, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date")); } else { ret = CP5200.CP5200_Net_SendClock(m_nCardID, 0, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date")); } if (0 <= ret) { MessageBox.Show("Successful"); } else { MessageBox.Show("Fail"); } } }
private void btnSendClock_Click(object sender, System.EventArgs e) { InitComm(); int nRet; if (m_nCommType == 1) //網口 { nRet = CP5200.CP5200_Net_SendClock(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date")); } else //串口 { nRet = CP5200.CP5200_RS232_SendClock(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, 3, 0, 7, 7, 1, 255, 255, 255, Marshal.StringToHGlobalAnsi("Date")); } if (nRet >= 0) { MessageBox.Show("Successful"); } else { MessageBox.Show("Fail"); } }