Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    (Delphi) Info Rete

    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'

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Beh ... gli errori mi sembrano chiari ...

    Cosa sono

    Stato

    e

    Rete

    ???
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  3. #3

  4. #4
    Originariamente inviato da camaleonteplus
    cioè?
    dove le hai dichiarate?

  5. #5
    quella parte di codice lo ho trovato come esempio forse parli della riga con @? non so dove dichiararlo stato e rete sono dei label. ma ho controllato sono rinominati giusti..

  6. #6

  7. #7
    controlla meglio sul form che il loro nome sia scritto correttamente perchè il compilatore ti sta dicendo che non sono stati dichiarati.
    Eventualmente prova a fare un "find in file".
    ciao
    sergio

  8. #8
    ci sono dichiarati penso che il problema sia il fatto che sto usando un componente Tlabel

  9. #9
    Utente di HTML.it L'avatar di danz67
    Registrato dal
    May 2005
    Messaggi
    213
    Originariamente inviato da camaleonteplus
    ci sono dichiarati penso che il problema sia il fatto che sto usando un componente Tlabel
    se Rete è una label non vanno usate le parentesi come nello showmessage ma semplicemente gli apici di apertura e chiusura


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.