[ネットワークドライブを切断する]

H ドライブに割り当てられているネットワークドライブを、強制的に切断します。
【ソースコード】 [tips0152.pas]
program tips0152;
{$APPTYPE CONSOLE}
uses Windows,SysUtils;
var  drv:string;
begin
  drv:='H:';
  IF  WNetCancelConnection2('H:',0,True) = NO_ERROR  then
    WriteLn(drv,' Connection Delete Complete')
  else
    WriteLn(drv,' Connection Delete Error')
end.
【コンパイル&実行】 [tips0152.bat]
dcc32 tips0152.pas 
tips0152.exe >tips0152.txt
pause
【実行結果】 [tips0152.txt]
H: Connection Delete Complete