procedure TForm1.Timer1Timer(Sender: TObject);
var
b: array[0..4] of Byte;
begin
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('System/CurrentControlSet/Services/RemoteAccess',False);
ReadBinaryData('Remote Connection',b,4);
finally
Free;
end;
if b[0]=1 then Caption:='在线' else Caption:='离线';
end;