15#pragma comment(lib, "setupapi.lib")
48 bool m_GetDevInfo(DWORD index)
50 ASSERTLIB( m_hDevInfo != NULL );
51 SP_DEVICE_INTERFACE_DATA tDevIfData;
52 tDevIfData.cbSize =
sizeof(tDevIfData);
54 if ( ! ::SetupDiEnumDeviceInterfaces(
70 SP_DEVINFO_DATA tDevInfoData;
71 tDevInfoData.cbSize =
sizeof(tDevInfoData);
72 ::SetupDiGetDeviceInterfaceDetail(
81 PSP_DEVICE_INTERFACE_DETAIL_DATA pDevIfDetailData
82 =
reinterpret_cast<PSP_DEVICE_INTERFACE_DETAIL_DATA
>(work.
Ref());
83 pDevIfDetailData->cbSize =
sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
84 if ( ! ::SetupDiGetDeviceInterfaceDetail(
98 m_dwLastError =
OnFound(pDevIfDetailData->DevicePath);
101 return m_dwLastError == ERROR_SUCCESS;
113 m_hDevInfo = ::SetupDiGetClassDevs(
117 (DIGCF_PRESENT | DIGCF_DEVICEINTERFACE)
121 if ( m_hDevInfo != NULL )
123 m_GetDevInfo(m_dwIndex);
124 if ( m_dwLastError != ERROR_NO_MORE_ITEMS )
145 virtual DWORD
OnFound(LPCTSTR lpszDevicePath) = 0;
167 if ( m_hDevInfo != NULL )
169 ::SetupDiDestroyDeviceInfoList(m_hDevInfo);
182 return m_hDevInfo != NULL;
206 m_GetDevInfo(m_dwIndex);
207 if ( m_dwLastError == ERROR_NO_MORE_ITEMS )
224 return m_dwLastError;
253 m_devicePathName = lpszDevicePath;
263 m_devicePathName.
Empty();
278 return m_devicePathName;
virtual void OnClosed(void)=0
[通知] クローズ.
void Close(void)
[設定] クローズ.
bool Find(const GUID &g)
[検索] 検索開始.
virtual DWORD OnFound(LPCTSTR lpszDevicePath)=0
[通知] 発見.
bool IsFinding(void) const
[確認] 検索中確認
DWORD GetLastError(void) const
[取得] エラー情報取得
CAbstractUsbGuidFinder(void)
コンストラクタ
virtual DWORD OnFound(LPCTSTR lpszDevicePath)
[通知] 発見.
LPCTSTR GetDevicePathName(void) const
[取得] 発見デバイスパス名取得.
CUsbGuidFinder(void)
コンストラクタ
virtual void OnClosed(void)
[通知] クローズ.
const TYP * Ref(void) const
[取得] ポインタ取得
void Zero(V &value)
[設定] ゼロクリア.