Page 1 sur 1
Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : mer. 23/nov./2022 14:42
par hoangdiemtinh
Hi admin,
I am newbie, from Viet Nam. Sorry for my bad English.
I am trying load information of Drives (Index + Name + Total Size + Total Partitions) to the ComboBox Gadget, like the picture
.

.
(HD = Hard Disk, RM = Removable = USB FLash, Card Reader)
.
An Uninitialized Drive is no have Letter Drive. Only can get information its via the Index Number of it.
.
Someone please help me (Prefer WinAPI, then maybe WMI).
Thanks.
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : mer. 23/nov./2022 17:47
par Mindphazer
Tiens, un bot intelligent...
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : mer. 23/nov./2022 21:04
par Ar-S
ça ressemble pas à un bot..
Please hoangdiemtinh could you juste write in english the color of that word. Thanks
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : jeu. 24/nov./2022 1:55
par hoangdiemtinh
@Ar-S
that word
I am new member, not ROBOT or BOT.
Sorry, my English is not good. I am using google translator.
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : jeu. 24/nov./2022 10:01
par Ar-S
Thank you and welcome.
Could you please try to write here your text in french here instead of english. Thanks.
You can use that API to show the drive information.
Tu peux utiliser cet API pour connaître les infos de tes lecteurs
I don't know how to detect disk partitioning.
Je ne sais pas comment détecter le partitionnement des disques.
Code : Tout sélectionner
EnableExplicit
Define lpFreeBytesAvailable.q
Define lpTotalNumberOfBytes.q
Define lpTotalNumberOfFreeBytes.q
GetDiskFreeSpaceEx_("C:\", @lpFreeBytesAvailable, @lpTotalNumberOfBytes, @lpTotalNumberOfFreeBytes)
Debug "Free space: " + Str(lpFreeBytesAvailable/1024/1024/1024) + " GB"
Debug "Used space: " + Str((lpTotalNumberOfBytes-lpFreeBytesAvailable)/1024/1024/1024) + " GB"
Debug "total: " + Str(lpTotalNumberOfBytes/1024/1024/1024) + " GB"
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : ven. 25/nov./2022 12:37
par Mesa
This is a work around with diskpart, because you can use diskpart with Windows, WinPE and WinRE.
Code : Tout sélectionner
Global Resultat$
Procedure Listdisk(Parameter)
prog = RunProgram("cmd.exe", "", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
If IsProgram(prog)
WriteProgramStringN(prog, "diskpart")
WriteProgramStringN(prog, "list disk")
WriteProgramStringN(prog, "exit")
WriteProgramStringN(prog, "exit")
While ProgramRunning(prog)
If AvailableProgramOutput(prog)
Answer$=ReadProgramString(prog)
If Answer$
Resultat$=resultat$+Answer$
EndIf
EndIf
Wend
CloseProgram(prog)
KillProgram(Prog)
EndIf
EndProcedure
Procedure Listpartition(Parameter)
prog = RunProgram("cmd.exe", "", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
If IsProgram(prog)
WriteProgramStringN(prog, "diskpart")
WriteProgramStringN(prog, "select disk "+Str(Parameter))
WriteProgramStringN(prog, "list partition")
WriteProgramStringN(prog, "exit")
WriteProgramStringN(prog, "exit")
While ProgramRunning(prog)
If AvailableProgramOutput(prog)
Answer$=ReadProgramString(prog)
If Answer$
Resultat$=resultat$+Answer$
EndIf
EndIf
Wend
CloseProgram(prog)
KillProgram(Prog)
EndIf
EndProcedure
Procedure ListVolume(Parameter)
prog = RunProgram("cmd.exe", "", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
If IsProgram(prog)
WriteProgramStringN(prog, "diskpart")
WriteProgramStringN(prog, "list volume")
WriteProgramStringN(prog, "exit")
WriteProgramStringN(prog, "exit")
While ProgramRunning(prog)
If AvailableProgramOutput(prog)
Answer$=ReadProgramString(prog)
If Answer$
Resultat$=resultat$+Answer$
EndIf
EndIf
Wend
CloseProgram(prog)
KillProgram(Prog)
EndIf
EndProcedure
Resultat$=""
CreateThread(@Listdisk(), 0)
Delay(500)
Debug Resultat$
disk$="Disque "; in french, so change it into your language !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ndisk=CountString(Resultat$,disk$)-1
Debug " count of Disks " + ndisk
For i=0 To ndisk-1
Resultat$=""
CreateThread(@Listpartition(), i)
Delay(500)
Debug Resultat$
partition$="Partition "; in french, so change it into your language !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
npartition=CountString(Resultat$,partition$)-1
Debug " count of partitions " + npartition
Next i
Resultat$=""
CreateThread(@ListVolume(), 0)
Delay(500)
Debug Resultat$
volume$="Volume "; in french, so change it into your language !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
nvolume=CountString(Resultat$,volume$)-1
Debug " count of volumes " + nvolume
In each 'Resultat$', you will find a lot of informations, and you can extract them with 'findstring()', ...
Mesa.
Re: Help me load the Index Number of Drives (the Uninitialized and Initialized Drives)
Publié : jeu. 01/déc./2022 11:26
par Ollivier