Search results for 'InetIsOffline'. 1 post(s) found.

  1. 2007/09/18 Are we connected to the Internet?
2007/09/18 08:23

Are we connected to the Internet?


Here's how to check whether you are connected to the Internet

procedure TForm1.Button1Click(Sender: TObject) ;

  function FuncAvail(_dllname, _funcname: string; var _p: pointer): boolean;
  {return True if _funcname exists in _dllname}
  var _lib: tHandle;
  begin
  Result := false;
  if LoadLibrary(PChar(_dllname)) = 0 then exit;
  _lib := GetModuleHandle(PChar(_dllname)) ;
  if _lib <> 0 then begin
   _p := GetProcAddress(_lib, PChar(_funcname)) ;
   if _p <> NIL then Result := true;
  end;
  end;

  {
  Call SHELL32.DLL for Win < Win98
  otherwise call URL.DLL
  }
  {button code:}
  var
  InetIsOffline : function(dwFlags: DWORD):
                  BOOL; stdcall;
  begin
  if FuncAvail('URL.DLL', 'InetIsOffline',
               @InetIsOffline) then
   if InetIsOffline(0) = true
    then ShowMessage('Not connected')
    else ShowMessage('Connected!') ;
  end;

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 02:08 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 10:14 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:40 delete

    moneyideas