C#检测串口被拔掉等一些触发事件合集


// //设备异常重载 // protected override void WndProc(ref Message m) { if (m.Msg == 0x0219) {//设备被拔出 if (m.WParam.ToInt32() == 0x8004)//usb串口 { //if (对串口进行操作) //{//产生异常 // 关闭串口 //} MessageBox.Show("USB转串口拔出"); } } base.WndProc(ref m); }

 2.commBox上面的值发生改变后触发的事件

 private void comboBox_jmtSort_select_TextChanged(object sender, EventArgs e)
{
....
}

 

posted @ 2015-01-27 21:44  fx427103  阅读(3565)  评论(0编辑  收藏  举报