⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devicecontroller.h

📁 简单的COM 实际例子 用法3
💻 H
字号:
#if !defined(AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_)
#define AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DeviceController.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CDeviceController frame

#if (WINVER < 0x0500)
#define DBT_DEVTYP_DEVICEINTERFACE      0x00000005  // device interface class
#define DBT_DEVTYP_HANDLE               0x00000006  // file system handle
#define DEVICE_NOTIFY_WINDOW_HANDLE     0x00000000
typedef  PVOID           HDEVNOTIFY;
#endif

extern "C"
{
	typedef BOOL (WINAPI *PUnregisterDeviceNotification)(IN HDEVNOTIFY Handle);
	typedef HDEVNOTIFY (WINAPI *PRegisterDeviceNotification)(IN HANDLE hRecipient,
															IN LPVOID NotificationFilter,
															IN DWORD Flags);
}

#if (WINVER < 0x0500)
typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
	DWORD		dbcc_size;
	DWORD		dbcc_devicetype;
	DWORD		dbcc_reserved;
	GUID		dbcc_classguid;
	char		dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
#endif


class CDeviceController : public CFrameWnd
{
	DECLARE_DYNCREATE(CDeviceController)
protected:
	CDeviceController();           // protected constructor used by dynamic creation

// Attributes
public:

protected:
	HDEVNOTIFY						mNotifyHandle;
	PRegisterDeviceNotification		mRegisterDeviceNotification;
	PUnregisterDeviceNotification	mUnregisterDeviceNotification;

	void Register(void);
	void Unregister(void);

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDeviceController)
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CDeviceController();

	// Generated message map functions
	//{{AFX_MSG(CDeviceController)
		// NOTE - the ClassWizard will add and remove member functions here.
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnClose();
	afx_msg BOOL OnDeviceChange( UINT nEventType, DWORD dwData );
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DEVICECONTROLLER_H__86FFE4DE_3A6C_4EC0_A4FA_FA626FA3CC62__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -