Programación General > Delphi

 Re: Como activar una conexión de Internet

(1/1)

ishela:
Hola a todos,
 alguien sabe como se puede activar desde código una conexión a Internet ya existente en un PC con W2000 ?

Probé:
Winexec('rundll rnaui.dll,RnaDial Conexion',SW_NORMAL);

pero no me funciona.

Grácias y saludos

LordRayman:
probastes asi ?

procedure TForm1.Button1Click(Sender: TObject);
var  
  cmd, par, fil, dir: PChar;
begin
  cmd := 'open';
  fil := 'rasdial.exe';
  par := PChar(edtEntry.Text + ' ' + edtUser.Text + ' ' + edtPass.Text);
  dir := 'C:';
  ShellExecute(Self.Handle, cmd, fil, par, dir, SW_SHOWMINNOACTIVE);
end;

LordRayman:
o asi ?


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
    // not connected
    if not InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE or
      INTERNET_AUTODIAL_FORCE_UNATTENDED, 0) then
    begin
      // error
    end;
end;

LordRayman:
algunos casos vas a necesitar
agregar a   WinInet en uses

Navegación

[0] Índice de Mensajes

Ir a la versión completa