Click External Button on seperate windows app

I would like to Programatically click on an external Button in a windows app.
I have downloaded Windowscrape.dll and using SPY++ to get the handler, etc...
using Visual Studio 2010.
Most examples i've seen haven't been helping me out...would appreciate it!
Who is Participating?
Shaggy1Author Commented:
Figured it is what i got..

 [DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
        static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);

        static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);

        public enum MouseEventFlags
            LEFTDOWN = 0x00000002,
            LEFTUP = 0x00000004,
            MIDDLEDOWN = 0x00000020,
            MIDDLEUP = 0x00000040,
            MOVE = 0x00000001,
            ABSOLUTE = 0x00008000,
            RIGHTDOWN = 0x00000008,
            RIGHTUP = 0x00000010

        public static void LeftClick(int x, int y)
            Cursor.Position = new System.Drawing.Point(x, y);
            mouse_event((int)(MouseEventFlags.LEFTDOWN), 0, 0, 0, 0);
            mouse_event((int)(MouseEventFlags.LEFTUP), 0, 0, 0, 0);

        private void timer2_Tick(object sender, EventArgs e)
            LeftClick(1050, 72);
            LeftClick(1180, 77);
            LeftClick(1180, 100);

Open in new window

a vb code, but you can get ideas through the lines of code you will see;
Shaggy1Author Commented:
this is the solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.