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

📄 devicemgr.h

📁 禁止usb,非常好的代码
💻 H
字号:
// devicemgr.h: interface for the CDeviceMgr class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DEVICEMGR_H__3D8E001E_8F97_4FDF_A282_95C8D77F56D3__INCLUDED_)
#define AFX_DEVICEMGR_H__3D8E001E_8F97_4FDF_A282_95C8D77F56D3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "device.h"

#include <setupapi.h>
#include <afxtempl.h>

/*
	To loop over all USB devices, use the following code:

  	CDeviceMgr mgr;
	POSITION pos;

	pos = mgr.GetHeadPosition();
	while (pos != NULL)
	{
		CDevice& device = mgr.GetNext(pos);

		... use device ...
	}
*/


class CDeviceMgr  
{
public:
	void Dump();
	POSITION FindDevice(CString hardwareID);
	CDevice& GetFoundDevice(POSITION pos);

	inline POSITION GetHeadPosition() { return deviceList.GetHeadPosition(); };
	inline CDevice& GetNext(POSITION& pos) { return deviceList.GetNext(pos); };
	inline CDevice& GetAt(POSITION& pos){return deviceList.GetAt(pos);};
	CDeviceMgr();
	virtual ~CDeviceMgr();

public:
	CList<CDevice,const CDevice&> deviceList;
	HDEVINFO m_hDev;
};

#endif // !defined(AFX_DEVICEMGR_H__3D8E001E_8F97_4FDF_A282_95C8D77F56D3__INCLUDED_)

⌨️ 快捷键说明

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