View Single Post
Old 06-05-2006, 05:33 PM   #2 (permalink)
office politics
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default

i believe SP_DEVICE_INTERFACE_DATA will be able to detect usb devices

visual c++
http://www.codeguru.com/forum/archiv.../t-273081.html
Code:
the code about usb
// find usb device
SP_DEVICE_INTERFACE_DATA strtInterfaceData;
BOOL bSuccess = SetupDiEnumDeviceInterfaces(hDevInfo,NULL,&guidHID,0,
&strtInterfaceData);
if (!bSuccess)
{
m_strLog += _T("sorry,cant find usb device");
SetupDiDestroyDeviceInfoList(hDevInfo);
return;
}

//if there is usb device,then read it's directory
SP_DEVICE_INTERFACE_DETAIL_DATA strtDetailData;
if (!SetupDiGetDeviceInterfaceDetail(hDevInfo,&strtInterfaceData,
&strtDetailData,sizeof(strtDetailData),NULL,NULL))
{
AfxMessageBox(_T("error when get usb's directory"));
SetupDiDestroyDeviceInfoList(hDevInfo);
return;
}

__________
http://www.codecomments.com/message577741.html

__________
http://www.alanmacek.com/usb/usb.c
office politics is offline