📄 devicelistctrl.h
字号:
#if !defined(AFX_DEVICELISTCTRL_H__08420ED1_A9D1_4426_93A4_A7170AA58E84__INCLUDED_)
#define AFX_DEVICELISTCTRL_H__08420ED1_A9D1_4426_93A4_A7170AA58E84__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DeviceListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDeviceListCtrl window
extern "C"
{
#include <cfgmgr32.h>
#include <newdev.h> // for the API UpdateDriverForPlugAndPlayDevices().
#include <setupapi.h> // for SetupDiXxx functions.
}
#include "InfFileHelper.h"
#include "DriverSetupHelper.h"
/*
存在的问题:当remove一个设备后,如果windows不重新找到此设备时,EzDriverSetup也会找不到此设备。
要用户手工在系统管理器中刷新windows重新找到设备后,EzDriverSetup才能正常工作。
应该有函数来刷新设备,但找了好久都没找到。
sofeice附带的ezDriverInstaller也有同样的问题。
by xwpcom 2005-05-07
已找到!在DDK的Tools时的devcon中有。
//*/
class CDeviceListCtrl : public CListCtrl
{
class CItemData
{
friend class CDeviceListCtrl;
int m_nDeviceIndex;
ULONG m_uStatus,m_uProblem;
SP_DEVINFO_DATA m_sdd;
CItemData()
{
m_nDeviceIndex = -1;
m_uStatus = m_uProblem = 0;
ZeroMemory(&m_sdd,sizeof(m_sdd));
m_sdd.cbSize = sizeof(m_sdd);
}
};
// Construction
public:
CDeviceListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDeviceListCtrl)
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
void OnBtn(UINT nID);
BOOL IsDeviceDisabled(int nIndex = -1);
BOOL Find(UINT nIDArr[], UINT cbSize, UINT nFind);
BOOL IsFunctionEnabled(UINT nID);
BOOL OpenInfFile(CString szInfFile);
BOOL DeleteAllItems();
void Reset();
virtual ~CDeviceListCtrl();
LRESULT OnDeviceChanged(WPARAM wp, LPARAM lp);
// Generated message map functions
protected:
void Test();
void Select(int nIndex);
int GetFirstSel();
void Init();
//{{AFX_MSG(CDeviceListCtrl)
afx_msg void OnDestroy();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
SP_CLASSIMAGELIST_DATA m_sid;
HDEVINFO m_hDevInfo;
CString m_szInfFile;
CString m_szCurHwID;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DEVICELISTCTRL_H__08420ED1_A9D1_4426_93A4_A7170AA58E84__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -