با کد زیر میشه از داخل برنامه بدون هیچ واسطه ای به اینترنت وصل شد.البته کانکشن باید از قبل ساخته شده باشه.

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ShellApi, StdCtrls;
type
TForm1 = class(TForm)
Connect: TButton;
Disconnect: TButton;
ConnectionName: TEdit;
UserName: TEdit;
PassWord: TEdit;
procedure DisconnectClick(Sender: TObject);
procedure ConnectClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DisconnectClick(Sender: TObject);
var
cmd,par,fil,dir:pchar;
begin
cmd:='open';
fil:='rasdial.exe';
par:=pchar(ConnectionName.Text+' /DISCONNECT');
dir:='C:';
ShellExecute(Self.Handle,cmd,fil,par,dir,SW_SHOWNORMAL)
end;
procedure TForm1.ConnectClick(Sender: TObject);
var
cmd,par,fil,dir:pchar;
begin
cmd:='open';
fil:='rasdial.exe';
par:=pchar(ConnectionName.Text+' '+UserName.Text+' '+PassWord.Text);
dir:='c:';
ShellExecute(Self.Handle,cmd,fil,par,dir,SW_SHOWNORMAL)
end;
end.

این هم یک کد دیگه که با استفاده از اون میشه با اینترنت کانکشن پیش فرض کانکت شد

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,wininet, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
dwConnectionTypes:dword;
begin
dwConnectionTypes:=INTERNET_CONNECTION_MODEM+
INTERNET_CONNECTION_LAN+
INTERNET_CONNECTION_PROXY;
if not InternetGetConnectedState(@dwConnectionTypes,0) then
if not InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE or
INTERNET_AUTODIAL_FORCE_UNATTENDED,0) then
begin
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
dwConnectionTypes:dword;
begin
dwConnectionTypes:=INTERNET_CONNECTION_MODEM+
INTERNET_CONNECTION_LAN+
INTERNET_CONNECTION_PROXY;
if InternetGetConnectedState(@dwConnectionTypes,0) then
InternetAutodialHangup(0)
end;
end.