Как узнать, подключён ли компьютер к сети ?

  if GetSystemMetrics(SM_NETWORK) and $01 = $01 then 
    ShowMessage('Computer is attached
                 to a network!') 
  else 
    ShowMessage('Computer is not 
                 attached to a network!');