Page 1 of 1

enumerate all PNPs

Posted: Fri Jan 28, 2005 8:48 pm
by bingo
Code updated For 5.20+

:lol:

Code: Select all

#DIGCF_PRESENT                     =   2 
#DIGCF_ALLCLASSES                  =   4 

hDeviceInfoSet = SetupDiGetClassDevs_(0,0,0,#DIGCF_PRESENT|#DIGCF_ALLCLASSES)

Structure SP_DEVINFO_DATA 
  cbSize.l 
  ClassGuid.GUID 
  DevInst.l 
  Reserved.l 
EndStructure 

DeviceInfoData.SP_DEVINFO_DATA 

DeviceInfoData\cbSize=SizeOf(DeviceInfoData) 

i=0
OpenLibrary(1,"cfgmgr32.dll") 
*F1 = GetFunction(1, "CM_Get_Device_IDA") 
While SetupDiEnumDeviceInfo_(hDeviceInfoSet,i,@DeviceInfoData)
i+1
pnplen = 255
pnp.s = Space(pnplen)
CallFunctionFast(*F1,DeviceInfoData\DevInst,@pnp,pnplen,0) 
Debug pnp
Wend
SetupDiDestroyDeviceInfoList_(hDeviceInfoSet)
CloseLibrary(1)