i get with SetupDiGetClassDevs and DIGCF_ALLCLASSES all devices
on my system, including the ones that are not attached to my system. This
is exactly what i want, but how can i see which device in my list ist
attached to the system and which one is not, Is there some flag somewhere
in a data structure i can get by calling something,...?
TIA,...
Regards
Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
--PA
"Kerem Gümrükcü" <kare...@hotmail.com> wrote in message
news:OEt#Dn26IH...@TK2MSFTNGP02.phx.gbl...
i either use DIGCF_PRESENT or the DIGCF_ALLCLASSES, depending
on what i need, but mostly i have to see ALL devices on my system, so the
point is to select between devices that are attached physically to my system
and those who are not,...there must be some flag somewhere or a SetupDi*
function that can do this for me,...
> i either use DIGCF_PRESENT or the DIGCF_ALLCLASSES, depending
> on what i need, but mostly i have to see ALL devices on my system, so the
> point is to select between devices that are attached physically to my
> system
> and those who are not,...there must be some flag somewhere or a SetupDi*
> function that can do this for me,...
Here's what I do, using the devInfo returned by SetupDiEnumDeviceInfo():
if( CM_Get_DevNode_Status( &lStatus, &lProblem, devInfo.DevInst, 0 ) !=
CR_SUCCESS )
printf( "device is currently not attached\n" );
else
{
if( lProblem == 0 )
printf( "device is running\n" );
else if( lProblem == CM_PROB_DISABLED )
printf( "device has been disabled\n" );
else
printf( "device has a problem, code %d\n", lProblem );
}
Kerem Gümrükcü wrote:
> Hi Pavel,
>
> i either use DIGCF_PRESENT or the DIGCF_ALLCLASSES, depending
> on what i need, but mostly i have to see ALL devices on my system, so the
> point is to select between devices that are attached physically to my
> system
> and those who are not,...there must be some flag somewhere or a SetupDi*
> function that can do this for me,...
>
> Regards
>
> Kerem
>
In addition to what Wilhelm noeker wrote: You might want to do a
CM_Get_DevNode_Status/CM_Get_DevNode_Status_Ex on the device node and
examine the status for the device that is returned. If the flag
DN_NO_SHOW_IN_DM is set, you can leave out that device.
--
S
Hi Kerem,
Use DIGCF_PRESENT to select _only_ devices that are currently attached.
This and DIGCF_ALLCLASSES are independent.
However - as Wilhelm Noeker wrote - attached devices can be either
working or having some problem (code 10, code 12, etc).
This you can see with CM_Get_DevNode_Status().
Regards,
--PA
If you absolutly need to know about non-present devices (not many people
do), then CM_Get_DevNode_Status() is your best bet for distinguishing between
present and non-present.
Also, if you know the specific Interface class(es) of the devices you're
interested in, (DIGCF_DEVICEINTERFACE) the call will be much faster if you
give it each interface class one by one.
Future versions of Windows may also have significant speedups if you provide
a specific setup Class GUID to the call.
Thanks,
-=Travis.Martin