devicecontroller.h

来自「DIRECTSHOW 开发指南电子书」· C头文件 代码 · 共 84 行

H
84
字号
#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 + =
减小字号Ctrl + -
显示快捷键?