procedure TForm5.BitBtn2Click(Sender: TObject);
var
EventHandle: THandle;
begin
EventHandle := CreateEvent(nil, False, False, nil);
if EventHandle <> Null then
begin
if RasConnectionNotification(INVALID_HANDLE_VALUE, EventHandle,
RASCN_Connection or RASCN_Disconnection) = 0 then
begin
if WaitForSingleObject(EventHandle, INFINITE) = WAIT_OBJECT_0 then
begin
MessageDlg('Ok', mtInformation, [mbOK], 0);
end;
end;
CloseHandle(EventHandle);
end;
end;
get ras.pas at http://delphi-jedi.org