資源簡介
C#+串口和USB通信編程(代碼)C#+串口和USB通信編程(代碼)C#+串口和USB通信編程(代碼) C#+串口和USB通信編程(代碼)C#+串口和USB通信編程(代碼)C#+串口和USB通信編程(代碼)

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
namespace?USB
{
????public?partial?class?Form1?:?Form
????{
????????public?const?int?WM_DEVICECHANGE?=?0x219;
????????public?const?int?DBT_DEVICEARRIVAL?=?0x8000;
????????public?const?int?DBT_CONFIGCHANGECANCELED?=?0x0019;
????????public?const?int?DBT_CONFIGCHANGED?=?0x0018;
????????public?const?int?DBT_CUSTOMEVENT?=?0x8006;
????????public?const?int?DBT_DEVICEQUERYREMOVE?=?0x8001;
????????public?const?int?DBT_DEVICEQUERYREMOVEFAILED?=?0x8002;
????????public?const?int?DBT_DEVICEREMOVECOMPLETE?=?0x8004;
????????public?const?int?DBT_DEVICEREMOVEPENDING?=?0x8003;
????????public?const?int?DBT_DEVICETYPESPECIFIC?=?0x8005;
????????public?const?int?DBT_DEVNODES_CHANGED?=?0x0007;
????????public?const?int?DBT_QUERYCHANGECONFIG?=?0x0017;
????????public?const?int?DBT_USERDEFINED?=?0xFFFF;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????protected?override?void?WndProc(ref?Message?m)
????????{
????????????try
????????????{
????????????????if?(m.Msg?==?WM_DEVICECHANGE)
????????????????{
????????????????????switch?(m.WParam.ToInt32())
????????????????????{
????????????????????????case?WM_DEVICECHANGE://
????????????????????????????break;
????????????????????????case?DBT_DEVICEARRIVAL://U盤插入
????????????????????????????DriveInfo[]?s?=?DriveInfo.GetDrives();
????????????????????????????foreach?(DriveInfo?drive?in?s)
????????????????????????????{
????????????????????????????????if?(drive.DriveType?==?DriveType.Removable)
????????????????????????????????{
????????????????????????????????????richTextBox1.AppendText(“U盤已插入,盤符為:“?+?drive.Name.ToString()?+?“\r\n“);
????????????????????????????????????break;
????????????????????????????????}
????????????????????????????}
????????????????????????????break;
????????????????????????case?DBT_CONFIGCHANGECANCELED:
????????????????????????????MessageBox.Show(“2“);
????????????????????????????break;
????????????????????????case?DBT_CONFIGCHANGED:
????????????????????????????MessageBox.Show(“3“);
????????????????????????????break;
????????????????????????case?DBT_CUSTOMEVENT:
????????????????????????????MessageBox.Show(“4“);
????????????????????????????break;
????????????????????????case?DBT_DEVICEQUERYREMOVE:
????????????????????????????MessageBox.Show(“5“);
????????????????????????????break;
????????????????????????case?DBT_DEVICEQUERYREMOVEFAILED:
????????????????????????????MessageBox.Show(“6“);
????????????????????????????break;
????????????????????????case?DBT_DEVICEREMOVECOMPLETE:?//U盤卸載
????????????????????????????richTextBox1.AppendText(“U盤已卸載,盤符為:“);
????????????????????????????break;
????????????????????????case?DBT_DEVICEREMOVEPENDING:
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????922??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort.sln
????..A..H.?????14848??2008-06-27?09:56??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort.suo
?????文件???????6820??2008-06-24?16:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Form1.cs
?????文件???????4747??2008-06-24?14:29??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Form1.Designer.cs
?????文件???????6008??2008-06-24?14:29??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Form1.resx
?????文件???????3229??2008-06-24?12:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\HexCommPort.csproj
?????文件????????470??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Program.cs
?????文件??????24576??2008-06-24?16:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\bin\Debug\HexCommPort.exe
?????文件??????26112??2008-06-24?16:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\bin\Debug\HexCommPort.pdb
?????文件???????5632??2005-12-08?14:51??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\bin\Debug\HexCommPort.vshost.exe
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\bin\Debug
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\bin
?????文件????????296??2008-06-27?09:54??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\HexCommPort.csproj.FileList.txt
?????文件????????842??2008-06-24?14:29??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\HexCommPort.csproj.GenerateResource.Cache
?????文件??????24576??2008-06-24?16:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\HexCommPort.exe
?????文件????????180??2008-06-24?14:29??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\HexCommPort.Form1.resources
?????文件??????26112??2008-06-24?16:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\HexCommPort.pdb
?????文件????????180??2008-06-24?12:00??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\HexCommPort.Properties.Resources.resources
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\Refactor
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug\TempPE
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj\Debug
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\obj
?????文件???????1184??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties\AssemblyInfo.cs
?????文件???????2876??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties\Resources.Designer.cs
?????文件???????5612??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties\Resources.resx
?????文件???????1094??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties\Settings.Designer.cs
?????文件????????249??2008-06-24?11:47??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties\Settings.settings
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort\Properties
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort\HexCommPort
?????目錄??????????0??2008-07-04?12:41??C#?串口和USB通信編程\串口\HexCommPort
............此處省略75個文件信息
- 上一篇:基于C#的窗體彈球小程序
- 下一篇:WPF中的DateTimePicker控件
評論
共有 條評論