Sponsored Ad

Tuesday, September 29, 2009

C# Thread

At its most basic level, a thread is an independent path of execution within an application. By "independent," I beggarly that the cilia acts a little like a mini-program, but  important to accept that all accoutrement are in actuality endemic by a accustomed application. In other words, a thread can’t just come into existence spontaneously, do some work, and then vanish. Rather, all accoutrement are absolutely created by an appliance and again managed by the runtime environment specifically, the Common Language.

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Timers;
using System.Threading;
namespace ToadwaterMacro
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        [DllImportAttribute("User32.dll")]
        private static extern int FindWindow(String ClassName, String
        WindowName);
        [DllImportAttribute("User32.dll")]
        private static extern int SetForegroundWindow(int hWnd);
        private void button1_Click(object sender, EventArgs e)
        {
                int hWnd = FindWindow(null, textBox1.Text);
                if (hWnd > 0)
                {
                    int i = 0;
                    string P = Keys.P.ToString();
                    while (i < 7)
                    {
                        SetForegroundWindow(hWnd);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        SendKeys.Send(P);
                        Thread.Sleep(40000);
                        i++;
                    }
                }
            }
        }
}

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers