DelphiFAQ Home Search:
General :: Programming :: Delphi :: Network
Network (local network and Internet) programming under Windows with Delphi.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Detect whether the network is installed


I need to programmatically find out if a computer has the network installed.


You can use the Windows function GetSystemMetrics(SM_NETWORK). This will tell you if the Windows installation includes network connection(s).

Sometimes it is claimed that this function will detect whether the machine is actually attached to a network. This is not true. The function will return the same resullts if the network connection is disabled and your computer is thus offline (not part of the network).

   Name:       TForm1.Button1Click
 procedure TForm1.Button1Click(Sender: TObject);
 begin { TForm1.Button1Click }
   if GetSystemMetrics(SM_NETWORK) and $01=$01 then
     ShowMessage('Computer is attached to a network!')
     ShowMessage('Computer is not attached to a network!')
 end; { TForm1.Button1Click }

Generated 0:01:38 on Aug 11, 2020