#include <dbt.h> LRESULT CMFCApplication1Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: 在此添加专用代码和/或调用基类 PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)lParam; PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb; TCHAR szMsg[80]; char driveName; switch (message) { case WM_DEVICECHANGE: switch (wParam) { case DBT_DEVICEARRIVAL: ::MessageBox(0, _T("检测到USB设备"), _T("WM_DEVICECHANGE"), MB_OK); break; case DBT_DEVICEREMOVECOMPLETE: ::MessageBox(0, _T("USB设备拔出"), TEXT("WM_DEVICECHANGE"), MB_OK); break; default: ; } break; default: ; } return CDialogEx::WindowProc(message, wParam, lParam); }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。