was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

65 Visitors Online


 
...eine Internetverbindung aufbauen?
Autor: Andreas Rumsch
Homepage: http://www.ardesign.ch
[ Tip ausdrucken ]  

Tip Bewertung (10):  
     


unit Unit1;

{ This unit shows how you can establish a connection to the internet without any
  user interaction.}
{ Diese Unit zeigt, wie eine Verbindung zum Internet aufgebaut werden kann, ohne
  dass der Benutzer eingreifen muss.}

interface

uses
  
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  
TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    edtEntry: TEdit;  // holds the name of the connection, e.g. 'bluewin'
    
edtUser: TEdit;   // the username for the above connection
    
edtPass: TEdit;   // and the password
    
procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    
{ Private declarations }
  
public
    
{ Public declarations }
  
end;

var
  
Form1: TForm1;

implementation

uses 
shellapi;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var 
  
cmd, par, fil, dir: PChar;
begin
  
// establish the connection
  // die Verbindung aufbauen
  // 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
  // rasdial mit Shellexecute aufrufen
  
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
  // Verbindung zum Internet abbrechen
  
cmd := 'open';
  fil := 'rasdial.exe';
  par := PChar(edtEntry.Text + ' /DISCONNECT');
  dir := 'C:';
  ShellExecute(Self.Handle, cmd, fil, par, dir, SW_SHOWMINNOACTIVE);
end;

end.


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners