c#-检查USB硬件变化
生活随笔
收集整理的這篇文章主要介紹了
c#-检查USB硬件变化
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Windows消息事實就是一個數值。
private const int WM_DEVICECHANGE = 0x219; //設備改變 private const int DBT_DEVICEARRIVAL = 0x8000; //檢測到新設備private const int DBT_DEVICEREMOVECOMPLETE = 0x8004; //移除設備private const int DBT_DEVTYP_VOLUME = 0x00000002; //邏輯卷標const int DBT_CONFIGCHANGECANCELED = 0x0019; //配置改變取消const int DBT_CONFIGCHANGED = 0x0018; //配置改變const int DBT_CUSTOMEVENT = 0x8006;const int DBT_DEVICEQUERYREMOVE = 0x8001;const int DBT_DEVICEREMOVEPENDING = 0x8003;const int DBT_DEVICETYPESPECIFIC = 0x8005;const int DBT_DEVNODES_CHANGED = 0x0007;const int DBT_QUERYCHANGECONFIG = 0x0017;const int DBT_USERDEFINED = 0xFFFF;[StructLayout(LayoutKind.Sequential)]public struct DEV_BROADCAST_VOLUME{public int dbcv_size;public int dbcv_devicetype;public int dbcv_reserved;public int dbcv_unitmask;}Wndproc是Windows操作系統向應用程序發送一系列消息之一,每個窗口會有一個窗口過程的回調函數,分別是窗口句柄、消息ID、WPARAM、LPARAM。
重寫WndProc函數,對不同消息事件進行處理
總結
以上是生活随笔為你收集整理的c#-检查USB硬件变化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Microbit-高温报警系统
- 下一篇: RoboDK仿真