con questo codice posso avere le informazioni di connessioni ma non voglio lo showmessage.
codice:
Function HayConexion: boolean;
var
flags: dword;
begin
Result := InternetGetConnectedState(@flags, 0);
if Result then
begin
showmessage('Conexion a Internet Activa');
if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
showmessage('Conexion por modem');
if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
showmessage('Conexion por lan');
if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
showmessage('Conexion por proxy');
if (flags and INTERNET_CONNECTION_MODEM_BUSY) =INTERNET_CONNECTION_MODEM_BUSY then
showmessage('modem busy');
end;
end;
begin
HayConexion;
Allora ho fatto cosi.
codice:
procedure TForm1.TCPInfoClick(Sender: TObject);
begin
InfoDominio.Caption:= (TCP.LocalDomainName);
HostLocale.Caption:= (TCP.LocalHostName);
end;
Function HayConexion: boolean;
var
flags: dword;
begin
Result := InternetGetConnectedState(@flags, 0);
if Result then
begin
Stato.Caption:= ('Attiva');
if (flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
Rete.Caption:=('Modem');
if (flags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
Rete.Caption:=('Lan');
if (flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
Rete.Caption:=('Proxy');
if (flags and INTERNET_CONNECTION_MODEM_BUSY) =INTERNET_CONNECTION_MODEM_BUSY then
Rete.Caption:=('Modem Occupato');
end;
end;
begin
HayConexion;
end;
end.
ma mi da questo errore:
[Warning] Email.pas(226): Unsafe type 'PChar'
[Warning] Email.pas(243): Unsafe code '@ operator'
[Error] Email.pas(246): Undeclared identifier: 'Stato'
[Error] Email.pas(248): Undeclared identifier: 'Rete'