*--below is a valid guid which I can get a handle to cguid = [{36FC9E60-C465-11CF-8056-444553540000}] ? cguid *!* DIGCF_ALLCLASSES *!* Return a list of installed devices for all device setup classes or all device interface classes. *!* DIGCF_DEVICEINTERFACE *!* Return devices that support device interfaces for the specified device interface classes. *!* DIGCF_DEFAULT *!* Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes. *!* DIGCF_PRESENT *!* Return only devices that are currently present in a system. *!* DIGCF_PROFILE *!* Return only devices that are a part of the current hardware profile. #DEFINE ERROR_NO_MORE_ITEMS 259 #DEFINE ERROR_INVALID_PARAMETER 87 #DEFINE ERROR_INVALID_FLAGS 1004 #DEFINE ERROR_INSUFFICIENT_BUFFER 122 #DEFINE DIGCF_INTERFACEDEVICE 16 && 0x00000010 #DEFINE DIGCF_PRESENT 2 && 0x00000002 #define DIGCF_ALLCLASSES 4 *!* #define DIGCF_DEFAULT 0x00000001 // only valid with DIGCF_DEVICEINTERFACE *!* #define DIGCF_PRESENT 0x00000002 *!* #define DIGCF_ALLCLASSES 0x00000004 *!* #define DIGCF_PROFILE 0x00000008 *!* #define DIGCF_DEVICEINTERFACE 0x00000010 DECLARE SHORT StrToIntEx IN Shlwapi; STRING pszString, INTEGER dwFlags, INTEGER @pllRet DECLARE INTEGER GetLastError IN kernel32 DECLARE INTEGER SetupDiGetClassDevs IN setupapi.dll ; STRING @cGuid, ; STRING Enumerator, ; INTEGER hwndParent, ; INTEGER nFlags nflags = 0 Enumerator = [] hwndParent = 0 DECLARE INTEGER SetupDiEnumDeviceInterfaces IN setupapi; INTEGER DeviceInfoSet,; STRING @ DeviceInfoData,; STRING @ ByRefterfaceClassGuid,; INTEGER MemberIndex,; STRING @ DeviceInterfaceData sizeof = REPLICATE(' ',2048)+CHR(0) i = 1 nInfo = REPLICATE(' ',2048)+CHR(0) PSP_DEVINFO_DATA = [] lnpointer = 0 DO WHILE .T. lnpointer = SetupDiGetClassDevs(@cGuid,null,0,DIGCF_INTERFACEDEVICE) IF TYPE('lnpointer') = "N" .and. lnpointer > 0 lldestroy = .t. ? ' Handle to Device Set: ' ?? ALLTRIM(STR(lnpointer)) DeviceInfoSet = lnpointer i = 1 *--I have a handle to the device set (DeviceInfoSet) *--Now I need to step through the set and pass each item to the below function *!* IF !SetupDiEnumDeviceInterfaces(DeviceInfoSet, @nInfo , @cGuid, 0, @sizeof) *!* IF GetLastError() = ERROR_NO_MORE_ITEMS *!* EXIT *!* ELSE *!* EXIT *!* ENDIF *!* ELSE *!* EXIT *!* ENDIF ELSE EXIT ENDIF ENDDO IF lldestroy *--Cleanup ?'==================================================' ?'Cleaning Up...' DECLARE INTEGER SetupDiDestroyDeviceInfoList IN setupapi; INTEGER DeviceInfoSet llokay = SetupDiDestroyDeviceInfoList(lnpointer) ?' Releasing the handle - SetupDiDestroyDeviceInfoList Result: ' ?? llokay ?' Last Error: ' ?? GetLastError() ENDIF RETURN FUNCTION hex2dec (lcHex) #DEFINE STIF_SUPPORT_HEX 1 LOCAL lnRet lnRet = 0 IF StrToIntEx (lcHex, STIF_SUPPORT_HEX, @lnRet) = 1 RETURN lnRet ELSE RETURN 0 ENDIF RETURN ************************************************************************* // // Device information structure (references a device instance // that is a member of a device information set) // typedef struct _SP_DEVINFO_DATA { DWORD cbSize; GUID ClassGuid; DWORD DevInst; // DEVINST handle DWORD Reserved; } SP_DEVINFO_DATA, *PSP_DEVINFO_DATA; // // Device interface information structure (references a device // interface that is associated with the device information // element that owns it). // typedef struct _SP_DEVICE_INTERFACE_DATA { DWORD cbSize; GUID InterfaceClassGuid; DWORD Flags; DWORD Reserved; } SP_DEVICE_INTERFACE_DATA, *PSP_DEVICE_INTERFACE_DATA; // // Flags for SP_DEVICE_INTERFACE_DATA.Flags field. // #define SPINT_ACTIVE 0x00000001 #define SPINT_DEFAULT 0x00000002 #define SPINT_REMOVED 0x00000004 //>Hello Tracy,
>DECLARE INTEGER SomeFunc IN somedll.dll INTEGER @ nArraySize >LOCAL lnSize >lnSize = 0 >lnPointer = SomeFunc(@lnSize) >FOR xj = 1 TO lnSize > ? "Item", xj, SYS(2600,lnPointer) > lnPointer = lnPointer + 4 && + sizeof(char*) >ENDFOR >>