Mega Code Archive

 
Categories / Delphi / System
 

Start a dialup connection

uses ShellAPI; procedure TForm1.Button1Click(Sender: TObject); begin case OSVer of VER_PLATFORM_WIN32_NT: // Win NT, 2000, XP: {connection_name = the name of the connection in "Network and DialUp Connections", logon = logon string, password = password string. All are separated by spaces.} ShellExecute(Handle, 'open', 'rasdial.exe', 'connection_name logon password', nil, SW_HIDE); // disconnect: // ShellExecute(Handle, 'open', 'rasdial.exe', ' /disconnect', nil, SW_HIDE); VER_PLATFORM_WIN32_WINDOWS: // VERSION = 95, 98 (* Dial Up Networking (DUN) module: RNAUI.DLL command: rundll32.exe rnaui.dll,RnaDial {name of connection to establish} result: displays the Connect To dialog for the passed connection *) ShellExecute(Handle, PChar('open'), PChar('rundll32.exe'), PChar('rnaui.dll,RnaDial exact name of dialer entry TRACERT -h 1 -w 1'),nil, SW_NORMAL); end; end;