Je recherche encore à faire un code pour trouver le l'identifiant unique des lecteurs USB (la c'est bon). Par contre il faudrait que je trouve une solution pour connaitre la lettre ou il est associer.
Genre Mxxxxxxxxxxxxxx&0 > a : ect…
Le code pour avoir l'identifiant unique:
Code : Tout sélectionner
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; +--------------------------------------------------------------------------+
; | |
; +--------------------------------------------------------------------------+
EnableExplicit
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; +--------------------------------------------------------------------------+
; | |
; +--------------------------------------------------------------------------+
Procedure.s setCutLigne(value.s)
; ROUTINE DE DECOUPAGE DES REPERTOIRES.
Define i.l
For i=Len(value)-1 To 0 Step -1
If Mid(value, i, 1) = "\"
Break
EndIf
Next i
If i>0
ProcedureReturn Mid(value, i+1, Len(value)-(i))
Else
ProcedureReturn value
EndIf
EndProcedure
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; +--------------------------------------------------------------------------+
; | |
; +--------------------------------------------------------------------------+
Structure SP_DEVINFO_DATA
cbSize.l
ClassGuid.GUID
DevInst.l
Reserved.l
EndStructure
Define value.l
Define idlib.l
Define devic.l
Define devid.l
Define usbid.s
Define alias.s
Define hDeviceInfoSet.l
Define DeviceInfoData.SP_DEVINFO_DATA
hDeviceInfoSet = SetupDiGetClassDevs_(0, 0, 0, #DIGCF_PRESENT|#DIGCF_ALLCLASSES)
DeviceInfoData\cbSize = SizeOf(DeviceInfoData)
idlib = OpenLibrary(#PB_Any, "cfgmgr32.dll")
devic = GetFunction(idlib, "CM_Get_Device_IDA")
While SetupDiEnumDeviceInfo_(hDeviceInfoSet, value, @DeviceInfoData)
usbid = Space(255)
CallFunctionFast(devic, DeviceInfoData\DevInst, @usbid, Len(usbid), 0)
If Left(usbid, 7) = "USBSTOR"
Debug setCutLigne(usbid)
EndIf
value+1
Wend
CloseLibrary(idlib)
SetupDiDestroyDeviceInfoList_(hDeviceInfoSet)
Merci d'avance
GallyHC