| Autor |
Beitrag |
majolo
      
Beiträge: 334
Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
|
Verfasst: Fr 07.03.03 16:16
Hallo,
wie kann ich überprüfen, ob eine Verbindung zum Internet besteht?
Danke im vorraus.
Gruss
majolo
|
|
DaRkFiRe
      
Beiträge: 526
WinXP Home & Professional
C, C++, Delphi
|
Verfasst: Fr 07.03.03 16:41
Schau mal unter RASEnumConnections in der WinSDK-Hilfe nach. Brauchst dann nur noch die RAS HEADER...
_________________ Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
|
|
derDoc
      
Beiträge: 623
Win Vista Prof
D2007 Prof
|
Verfasst: Fr 07.03.03 17:28
Falls du kein Platform SDK hast ist hier ein Auszug daraus:
| Zitat: | RasEnumConnections
The RasEnumConnections function lists all active RAS connections. It returns each connection's handle and phone-book entry name.
DWORD RasEnumConnections(
LPRASCONN lprasconn,
LPDWORD lpcb,
LPDWORD lpcConnections
);
Parameters
lprasconn
[in, out] Pointer to a buffer that receives, on output, an array of RASCONN structures, one for each RAS connection.
On input, an application must set the dwSize member of the first RASCONN structure in the buffer to sizeof(RASCONN) in order to identify the version of the structure being passed.
lpcb
[in, out] Pointer to a variable that, on input, contains the size, in bytes, of the buffer specified by lprasconn.
On output, the function sets this variable to the number of bytes required to enumerate the RAS connections.
lpcConnections
[out] Pointer to a variable that receives the number of RASCONN structures written to the buffer specified by lprasconn. |
_________________ MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
|
|
bis11
      
Beiträge: 1247
Erhaltene Danke: 2
Apple Mac OSX 10.11
|
Verfasst: Fr 07.03.03 18:30
Hi,
ich hätte da zwei kleine Beispiele für Dich, die ich mal im Internet gefunden habe :
Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| uses StdCtrls, registry;
function IsConnected: Boolean; var reg: TRegistry; buff: DWORD; begin reg := TRegistry.Create; Reg.RootKey := HKey_local_machine; if reg.OpenKey('\System\CurrentControlSet\Services\RemoteAccess', False) then begin reg.ReadBinaryData('Remote Connection', buff, SizeOf(buff)); Result := buff = 1; reg.CloseKey; reg.Free; end; end; |
Beispiel 2:
Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| uses WinInet;
{...}
function IsConnectedToInternet: Boolean; begin Result := (InternetGetConnectedState(nil, 0)) end;
procedure TForm1.Button1Click(Sender: TObject); begin if IsConnectedToInternet then ShowMessage('Connected.') else ShowMessage('Not Connected.') end; |
Wenn mich nicht alles täuscht hatte ich diese beiden Beispiel von dieser Seite aus der Rubrik Programmiertipps
|
|
majolo 
      
Beiträge: 334
Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
|
Verfasst: Fr 07.03.03 21:57
@bis11: Vielen Dank dein 2. Code hat wunderbar funktioniert.
Den anderen auch vielen Dank für ihre Mühe.
Gruss
majolo
|
|
Pyr0cracker
      
Beiträge: 164
Win XP, Ubuntu 8.04, openSUSE 11.0
Delphi 7 Personal
|
Verfasst: Mi 12.03.03 22:53
bei mir funzt er nicht.
liegt das daran das ich einxp habe?
wenn ja gibts noch eine andere möglichkeit das zu checken?
ciao,
|
|
Leathl
      
Beiträge: 276
|
Verfasst: Mi 12.03.03 23:08
|
|
|