Example #1
0
 private void timer_Close_Excel_Tick(object sender, EventArgs e)
 {
     if (count == 0)
     {
         timer_Close_Excel.Stop();
         CmdHelper.killTaskByImageName("EXCEL.EXE");
         this.Close();
         return;
     }
     count--;
     btnCloseAllExcel.Text = count.ToString();
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ipAddr"></param>
        /// <returns></returns>
        public static bool pingTheAddress(string ipAddr)
        {
            Ping   pingSender = new Ping();
            string data       = "sendData: goodgoodgoodgoodgoodgood";

            byte[]    buffer  = Encoding.ASCII.GetBytes(data);
            int       timeout = 120;
            PingReply reply   = pingSender.Send(ipAddr, timeout, buffer);

            if (reply.Status == IPStatus.Success)
            {
                //结束该Ping
                CmdHelper.killTaskByImageName("PING.EXE");
                return(true);
            }
            CmdHelper.killTaskByImageName("PING.EXE");
            return(false);
        }
Example #3
0
 private void FrmPrompt_FormClosed(object sender, FormClosedEventArgs e)
 {
     timer_Close_Excel.Stop();
     CmdHelper.killTaskByImageName("EXCEL.EXE");
 }