Autor Beitrag
TheNeon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Di 20.05.03 11:19 
Hello people,

es gibt mehrere Methoden eine DFÜ-Verbindung herzustellen, aber wie ist das, wenn man einen Router hat, über den man sich verbinden läßt ?!

Wie stelle ich dann eine Verbindung her bzw. breche sie ab ?!? :?
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 20.05.03 12:05 
Hallo,
das geht so:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
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;


CU...
TheNeon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Di 20.05.03 12:39 
hi,
danke für den Code, aber :

ich habe ihn bei mir (ich habe keinen Router) bereits getestet gehabt und alles klappt bis zur Abfrage, ob ich gerade verbunden bin. Die Internetverbindung schließen oder öffnen geht nicht! .... macht der einfach nicht.

Sicher, dass das dann bei einem Router funzt??

[ Windows XP Prof SP1 - T-DSL]