线程


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
    Thread mouseThread = new Thread(new ThreadStart(Run));//两个线程共同做一件事情
            mouseThread.Name = "mouneClick";
            mouseThread.Start();

       public void Run()
    {
        int dx = 40;
        int dy = 40;
        while (true)
        {
            if (IsMouseStart)
            {
                //WriteLog(IsMouseStart.ToString());
                mouse_event((int)(MouseEventFlags.LeftDown | MouseEventFlags.Absolute), 0, 0, 0, IntPtr.Zero);
                mouse_event((int)(MouseEventFlags.LeftUp | MouseEventFlags.Absolute), 0, 0, 0, IntPtr.Zero);
                Thread.Sleep(100);

            }
           
        }
    }

//在最后要去掉线程
 if (mouseThread != null)
            {
                mouseThread.Abort();
            }