mobile中判断pda是否连接网络

mobile中判断pda是否连接网络转自http://blog.csdn.net/zst126/archive/2009/05/05/4151436.aspx

 //判断是否是否连接了网络
        public enum ConnectedStates
        {
            INTERNET_CONNECTION_MODEM      = 1,
            INTERNET_CONNECTION_LAN        = 2,
            INTERNET_CONNECTION_PROXY      = 4,
            INTERNET_CONNECTION_MODEM_BUSY = 8,
            INTERNET_RAS_INSTALLED         = 16,
            INTERNET_CONNECTION_OFFLINE    = 32,
            INTERNET_CONNECTION_CONFIGURED = 64,
        }

        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int desc,int reserved);

        public bool isConnectInternet()
        {
            Boolean bOnLine = true;
            int desc = 0;
            bOnLine = InternetGetConnectedState(out desc, 0);
            if(bOnLine)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

你可能感兴趣的:(mobile中判断pda是否连接网络)