首页  编辑  

断开拨号连接

Tags: /超级猛料/Network.网络通讯/FTP和拨号/   Date Created:

断开拨号连接

function DisconnectActiveConnection: Boolean;

var

 RasEntry: TRasEntry;

 EntryInfoSize: Cardinal;

 DeviceInfoSize: Cardinal;

 RasGetEntryPropertiesResult: Integer;

begin

 ZeroMemory(@RasEntry, SizeOf(TRasEntry));

 RasEntry.dwSize := SizeOf(TRasEntry);

 EntryInfoSize := SizeOf(TRasEntry);

 RasGetEntryPropertiesResult := RasGetEntryProperties(nil,

MyActiveEntryName), @RasEntry, EntryInfoSize, nil, DeviceInfoSize);

 if (RasGetEntryPropertiesResult = 0) then

   Result := DisconnectDevice(StrPas(RasEntry.szDeviceName));

end;