procedure TForm1.Button1Click(Sender: TObject);
var
cmd, par, fil, dir: PChar;
begin
// establish the connection
// rasdial.exe entryname username password
cmd := 'open';
fil := 'rasdial.exe';
par := PChar(edtEntry.Text + ' ' + edtUser.Text + ' ' + edtPass.Text);
dir := 'C:';
// call rasdial.exe with Shellexecute
ShellExecute(Self.Handle, cmd, fil, par, dir, SW_SHOWMINNOACTIVE);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
cmd, par, fil, dir: PChar;
begin
// disconnect the connection to the Internet
cmd := 'open';
fil := 'rasdial.exe';
par := PChar(edtEntry.Text + ' /DISCONNECT');
dir := 'C:';
ShellExecute(Self.Handle, cmd, fil, par, dir, SW_SHOWMINNOACTIVE);
end;