DeviceController.h
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:2k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. #if !defined(AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_)
  2. #define AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // DeviceController.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CDeviceController frame
  10. #if (WINVER < 0x0500)
  11. #define DBT_DEVTYP_DEVICEINTERFACE      0x00000005  // device interface class
  12. #define DBT_DEVTYP_HANDLE               0x00000006  // file system handle
  13. #define DEVICE_NOTIFY_WINDOW_HANDLE     0x00000000
  14. typedef  PVOID           HDEVNOTIFY;
  15. #endif
  16. extern "C"
  17. {
  18. typedef BOOL (WINAPI *PUnregisterDeviceNotification)(IN HDEVNOTIFY Handle);
  19. typedef HDEVNOTIFY (WINAPI *PRegisterDeviceNotification)(IN HANDLE hRecipient,
  20. IN LPVOID NotificationFilter,
  21. IN DWORD Flags);
  22. }
  23. #if (WINVER < 0x0500)
  24. typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
  25. DWORD dbcc_size;
  26. DWORD dbcc_devicetype;
  27. DWORD dbcc_reserved;
  28. GUID dbcc_classguid;
  29. char dbcc_name[1];
  30. } DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
  31. #endif
  32. class CDeviceController : public CFrameWnd
  33. {
  34. DECLARE_DYNCREATE(CDeviceController)
  35. protected:
  36. CDeviceController();           // protected constructor used by dynamic creation
  37. // Attributes
  38. public:
  39. protected:
  40. HDEVNOTIFY mNotifyHandle;
  41. PRegisterDeviceNotification mRegisterDeviceNotification;
  42. PUnregisterDeviceNotification mUnregisterDeviceNotification;
  43. void Register(void);
  44. void Unregister(void);
  45. // Operations
  46. public:
  47. // Overrides
  48. // ClassWizard generated virtual function overrides
  49. //{{AFX_VIRTUAL(CDeviceController)
  50. //}}AFX_VIRTUAL
  51. // Implementation
  52. protected:
  53. virtual ~CDeviceController();
  54. // Generated message map functions
  55. //{{AFX_MSG(CDeviceController)
  56. // NOTE - the ClassWizard will add and remove member functions here.
  57. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  58. afx_msg void OnClose();
  59. afx_msg BOOL OnDeviceChange( UINT nEventType, DWORD dwData );
  60. //}}AFX_MSG
  61. DECLARE_MESSAGE_MAP()
  62. };
  63. /////////////////////////////////////////////////////////////////////////////
  64. //{{AFX_INSERT_LOCATION}}
  65. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  66. #endif // !defined(AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_)