C# ile İnternet Bağlantı Kontrolü

        public class InternetCS
        {
            [DllImport("wininet.dll")]
            private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
            public static bool IsConnectedToInternet()
            {
                int Desc;
                return InternetGetConnectedState(out Desc, 0);
            }
        }


        private void button1_Click(object sender, EventArgs e)
        {
            if InternetCS.IsConnectedToInternet() == true

                {
                  MessageBox.Show("bağlantı var");
                }
        }

Comments are closed.

Post Navigation