[DUG] Detecting braodband connection

Robert martin rob at chreos.co.nz
Mon Oct 13 10:56:49 NZDT 2008


Interestingly this is the code I just added and tested....

function TFTPApplicatonUpdater.DetermineInternetConnectionType: 
TConnectionType;
//    TConnectionType = (ctModem, ctBroadBand, ctProxy, ctOffline);
var
    dwFlags     : DWORD;
begin
    Result := ctOffline;
    if (InternetGetConnectedState(@dwFlags, 0) = True) then begin
        if ((dwFlags and INTERNET_CONNECTION_MODEM) = 
INTERNET_CONNECTION_MODEM) then begin
            Result := ctModem;
        end
        else if ((dwFlags and INTERNET_CONNECTION_LAN) = 
INTERNET_CONNECTION_LAN) then begin
            Result := ctBroadBand;
        end
        else if ((dwFlags and INTERNET_CONNECTION_PROXY) = 
INTERNET_CONNECTION_PROXY) then begin
            Result := ctProxy;
        end
        else if ((dwFlags and INTERNET_CONNECTION_MODEM_BUSY) = 
INTERNET_CONNECTION_MODEM_BUSY) then begin
            Result := ctModem;
        end;
    end;


great minds eh :)

Alister Christie wrote:
> Yes I use a similar function, which I probably obtained from the same 
> place ;-)
> This is the first time I've looked at this piece of code for a few 
> years, it would certainly look a bit different if I wrote now.
>
> type
>   TICType = (TICTNone, TICTModem, TICTLan, TICTProxy);
>
> function Internet_Connection_Type : TICType;
> var
>   Flags : Dword;
> begin
>   Result := TICTNone;
>   if InternetGetConnectedState (@Flags, 0)
>   then begin
>        if (Flags and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM
>        then Result := TICTModem;
>        if (Flags and INTERNET_CONNECTION_MODEM_BUSY) = 
> INTERNET_CONNECTION_MODEM_BUSY
>        then Result := TICTModem;
>        if (Flags and INTERNET_CONNECTION_LAN  ) = INTERNET_CONNECTION_LAN
>        then Result := TICTLan;
>        if (Flags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY
>        then Result := TICTProxy;
>   end;
> end;
>
> Alister Christie
> Computers for People
> Ph: 04 471 1849 Fax: 04 471 1266
> http://www.salespartner.co.nz
> PO Box 13085
> Johnsonville
> Wellington 
>
>
>
> Conor Boyd wrote:
>   
>> I've used this function in the past with success on dial-up.
>>
>> http://www.garystimson.co.uk/delphi.html#18
>>
>> HTH,
>>
>> Conor
>>
>> -----Original Message-----
>> From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
>> On Behalf Of Robert martin
>>
>> I have an app that successfully checks for updates and automatuically
>> updates itself.  However for modem users I don't want it to
>> automatically bring up the dial up screen each time I start the app.  I
>> would like to detect the lack of broadband and bring up a prompt before
>> attempting to update.
>>
>> Any suggestions?
>>
>> _______________________________________________
>> NZ Borland Developers Group - Delphi mailing list
>> Post: delphi at delphi.org.nz
>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>>
>>   
>>     
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>
>   


More information about the Delphi mailing list