Re: Enumerating USB Ports in a PC and recognizing the connected de
- From: Sujay Ghosh <SujayGhosh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Apr 2009 10:22:03 -0700
Is it not possible to enumerate WITHOUT DDK
For example I can enumerate ports WITHOUT the DDK .
--
Sujay Ghosh
Bangalore, INDIA
"AliR (VC++ MVP)" wrote:
This comes with the DDK package. See if it helps:.
http://msdn.microsoft.com/en-us/library/dd163454.aspx
AliR.
"Sujay Ghosh" <SujayGhosh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:16A9D5A4-1AED-498D-AE21-2BE33A7A9FBD@xxxxxxxxxxxxxxxx
Hi ,
Env : Windows XP Pro / SP3
Visual Studio 6.0
I am NOT using Windows DDK .
I need to do the following :
1) Enumerate USB ports
2) Find the freindly name of the device attached with it . For example if
I
have Nokia data cable connected in my USB port , the freindly name of the
data cable should be displayed ...
Please find my code below :-
GUID guid = GUID_DEVCLASS_USB ;
SP_DEVICE_INTERFACE_DATA interfaceData;
ZeroMemory(&interfaceData, sizeof(interfaceData));
interfaceData.cbSize = sizeof(interfaceData);
SP_DEVINFO_DATA devInfoData;
ZeroMemory(&devInfoData, sizeof(devInfoData));
devInfoData.cbSize = sizeof(devInfoData);
HDEVINFO devInfo;
devInfo = SetupDiGetClassDevs( &guid ,
NULL,
NULL,
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE ) ;
TCHAR szBuf[100];
BOOL retval = false;
int nDevices = 0;
do {
memset(&devInfoData,0,sizeof(devInfoData));
devInfoData.cbSize = sizeof(devInfoData);
if ((retval=SetupDiEnumDeviceInfo(devInfo,nDevices,&devInfoData))!=FALSE)
{
if (SetupDiGetDeviceRegistryProperty(
devInfo,
&devInfoData,
SPDRP_FRIENDLYNAME,
NULL,
(PBYTE)szBuf,
sizeof(szBuf),
NULL))
m_PortName.AddString(szBuf);
nDevices++;
}
}
while (retval != FALSE);
Unfortunately the USB ports are not being displayed
Please help .
Thanks in advance .
Sujay
--
Sujay Ghosh
Bangalore, INDIA
--
Sujay Ghosh
Bangalore, INDIA
- Follow-Ups:
- Re: Enumerating USB Ports in a PC and recognizing the connected de
- From: Joseph M . Newcomer
- Re: Enumerating USB Ports in a PC and recognizing the connected de
- References:
- Enumerating USB Ports in a PC and recognizing the connected device
- From: Sujay Ghosh
- Re: Enumerating USB Ports in a PC and recognizing the connected device
- From: AliR \(VC++ MVP\)
- Enumerating USB Ports in a PC and recognizing the connected device
- Prev by Date: Re: How to start my app after install
- Next by Date: Re: How to start my app after install
- Previous by thread: Re: Enumerating USB Ports in a PC and recognizing the connected device
- Next by thread: Re: Enumerating USB Ports in a PC and recognizing the connected de
- Index(es):
Relevant Pages
|