示例#1
0
        public Main()
        {
            InitializeComponent();

            foreach (ProcessInfo proc in Program.ProcList)
            {
                listBox1.Items.Add(proc.Name);
            }

            if (Program.ViewOnly)
            {
                btnTerminate.Text    = "Ok";
                btnTerminate.Enabled = true;
                label1.Text          = "Processes open in this desktop:";
                return;
            }

            Timer t    = new Timer();
            int   time = 5;

            btnTerminate.Text = time.ToString();
            t.Tick           += delegate
            {
                time--;

                if (time < 1)
                {
                    btnTerminate.Text    = "Terminate";
                    btnTerminate.Enabled = true;
                    t.Stop();
                }
                else
                {
                    btnTerminate.Text = time.ToString();
                }
            };
            t.Interval = 1000;
            t.Start();

            WinAPI.FLASHWINFO fInfo = new WinAPI.FLASHWINFO();

            fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd      = this.Handle;
            fInfo.dwFlags   = WinAPI.FLASHW_CAPTION;
            fInfo.uCount    = 6;
            fInfo.dwTimeout = 50;

            WinAPI.FlashWindowEx(ref fInfo);
        }
示例#2
0
        public Main()
        {
            InitializeComponent();

            foreach (ProcessInfo proc in Program.ProcList)
                listBox1.Items.Add(proc.Name);

            if (Program.ViewOnly)
            {
                btnTerminate.Text = "Ok";
                btnTerminate.Enabled = true;
                label1.Text = "Processes open in this desktop:";
                return;
            }

            Timer t = new Timer();
            int time = 5;
            btnTerminate.Text = time.ToString();
            t.Tick += delegate
            {
                time--;

                if (time < 1)
                {
                    btnTerminate.Text = "Terminate";
                    btnTerminate.Enabled = true;
                    t.Stop();
                }
                else
                    btnTerminate.Text = time.ToString();
            };
            t.Interval = 1000;
            t.Start();

            WinAPI.FLASHWINFO fInfo = new WinAPI.FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = this.Handle;
            fInfo.dwFlags = WinAPI.FLASHW_CAPTION;
            fInfo.uCount = 6;
            fInfo.dwTimeout = 50;

            WinAPI.FlashWindowEx(ref fInfo);
        }