1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
function TControleConnexions.LibereConnexion (stLettres1 : shortstring; bForce1 :Boolean ) : boolean ;
var
s1 : smallint ;
st2,st3 : shortstring ;
zst2,zst3 : Array[0..MAX_PATH] of char;
lw1,lw2 : Longword;
b1 : boolean ;
begin
// Libère si active la ou les connexions relatives aux lettres dans st1
// ex st1 := 'FGHI'. Si bForce1 alors deconnexion inconditionnelle
b1 := true ; // test bon déroulement
stLettres1 := upperCase(stLettres1) ;
for s1 := 1 to length(stLettres1) do
if (stLettres1[s1]>='A') and (stLettres1[s1]<='Z') then
begin
st2 := stLettres1[s1]+':';
lw2 := 255 ;
WnetGetConnection(StrPCopy(zst2,st2),zSt3,lw2);
st3 := strpas(zst3) ;
if st3 <> '' then
begin
lw1 := wnetcancelconnection2(zst2,CONNECT_UPDATE_PROFILE,bForce1);
if lw1<>NO_ERROR then
begin
b1 := false ;
MessageErreur (1,lw1) ;
end ;
end;
end;
if b1 then
StringListHisto1.Add (TimeToStr(Time)+' Déconnexion des lettres '+Uppercase(stLettres1)+' OK') ;
result := b1 ;
end; |
Partager