Effectivement, j'ai trouvé cette fonction sur le net, mais si on regarde bien, le nom de volume est un nom au format DOS, c à dire sur 12 caractères.
Or moua je veux le nom long.
J'ai trouvé une solution pour avoir les noms longs sous DOS mais cette fonction ne marche pas en Delphi.
{ Unit‚ pour lister les noms longs sous windows }
unit lfiles;
interface
type t_long_dta=record
attr:byte;
a:array[0..30]of byte;
size:longint;
b:array[0..7]of byte;
nom:array[0..255]of byte;
end;
var dta:t_long_dta;
masque:string;
handle:word;
function findfirst:boolean;
function findnext:boolean;
function nom_dta:string;
implementation
function findfirst:boolean;
begin
asm
push ds
push ds
pop es
mov cx,$3F
mov dx,offset masque
inc dx
mov di,offset dta
xor si,si
mov ax,$714E
int $21
jnb @suite1
xor ax,ax
jmp @fin1
@suite1:
mov handle,ax
mov ax,1
@fin1:
pop ds
end;
findfirst:=true;
end;
function findnext:boolean;
begin
asm
push ds
push ds
pop es
mov bx,handle
mov di,offset dta
xor si,si
mov ax,$714F
int $21
jnb @suite2
xor ax,ax
jmp @fin2
@suite2:
mov ax,1
@fin2:
pop ds
end;
findnext:=false;
end;
function nom_dta:string;
var i:word;
n:string;
begin
n:='';
i:=0;
while (dta.nom[i]<>0)and (i<255) do
begin
n:=n+chr(dta.nom[i]);
inc(i);
end;
nom_dta:=n;
end;
begin
masque:='*'+#0;
end.
Et si on filtre avec l'attribut VolumeID on a le nom de volume en NomLong.
Sauf que çà ne marche pas sous Windows.
Alors il faut que je trouve l'API qu'il faut.
Ou éventuellement la correspondance win98 de TDriveComboBox !
Voilà
Merci beaucoup JWhy
Edo
---------------
Savoir -> Pouvoir & Freedom aussi