Einzelnen Beitrag anzeigen

Benutzerbild von Uncle Cracker
Uncle Cracker

Registriert seit: 30. Mär 2003
Ort: Freital
694 Beiträge
 
#3
  Alt 13. Mai 2003, 16:22
Habe das bei www.swissdelphicenter.ch gefunden.

Delphi-Quellcode:
uses
  WinInet;

// Causes the modem to automatically dial the default Internet connection.
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;


// hangup the default Internet connection.
procedure TForm1.Button2Click(Sender: TObject);
var
  dwConnectionTypes: DWORD;
begin
  dwConnectionTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN +
    INTERNET_CONNECTION_PROXY;
  if InternetGetConnectedState(@dwConnectionTypes, 0) then
    // connected
    InternetAutodialHangup(0);
end
Funktioniert sogar unter Delphi 4 Standard!
  Mit Zitat antworten Zitat