Hi, can someone explain this. delphi code.. internet connection status -
Can anybody explain this to me like I'm two years, not that he did not understand a fetish, just I do not Which router is, number 3? 4 What does it do?
Uses WinInet; Cost modem = 1; LAN = 2; Proxy = 4; Bus = 8; Function GetConnectionKind (var strKind: string): Boolean; Var Flags: DWORD; Start strKind: = ''; Results: = InternetGetConnectedState (@flags, 0); If the result when it is triggered (flags and modem) = modem then strKind: = 'Modem'; If (flags and lanes) = LAN then strKind: = 'LAN'; If (flags and proxy) = proxy then strKind: = 'Proxy'; If (flags and busy) = just strKind: = 'Modem busy'; End; End; Process TForm1.Button1Click (Sender: Tubbed); Var strKind: string; If GetConnectionKind (strKind) then ShowMessage (strKind) will begin; End; [InternetGetConnectedState] (the Bitmask first parameter that looks like this:
/ P>
76543210 & lt; - bit number || |||| || || + + - INTERNET_CONNECTION_MODEM || || + - INTERNET_CONNECTION_LAN || | + --- INTERNET_CONNECTION_PROXY || + - --- INTERNET_CONNECTION_MODEM_BUSY (no longer used) | + ------ INTERNET_CONNECTION_OFFLINE + ------- INTERNET_CONNECTION_CONFIGURED
type if went given a bit, the connection is in. so if bit Norte is set to 2, you can connect to the proxy.
in addition, the function has a TR UE / FALSE gives value, indicating whether you are connected to the Internet or not.
In your code, you have values, 1, 2, 4, 8, that match the decimal value of those bits Counts from right to left.
Actually the code inspects each and every time, and sets the strKind variable for a text to indicate the nature of the connection.
Are you asking "whic h router? 3? ", And I believe that you mean" How do I know that my connection is through a router? " "I would think it would be like a LAN connection. Perhaps there is a bridge somewhere to use the LAN via Internet.
Comments
Post a Comment