Jump to content

(c#)need a little help

Darkraisisi

i wanted to make a leftmouse button clicker but it doesnt work , could you help me ?

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Threading;namespace ConsoleApplication3{    class Program    {        static void Main(string[] args)        {            Thread mouseKlickThread = new Thread(new ThreadStart(MouseKlickThread));        }            {                mouseKlickThread.start();            }            #region Thread Functions            public static void MouseKlickThread()        {                     while (true)                 {                        //the left click function suppose to be here                       Console.WriteLine("5 seconds have passed");                 }                    Thread.Sleep(5000);                }            }        }    }}
Link to comment
Share on other sites

Link to post
Share on other sites

i've never used c# but do you have some kind of OnClickListener? You want the thread to check for some click activity (will probably be a boolean) and update accordingly

AMD FX8350  2x ASUS Radeon R9 270X 4GB  ASUS Sabertooth 990FX  -  Crucial Ballistix Sport DDR3 16GB

Link to comment
Share on other sites

Link to post
Share on other sites

i've never used c# but do you have some kind of OnClickListener? You want the thread to check for some click activity (will probably be a boolean) and update accordingly

no , i want the program to auto click every 10 sec (leftclick)

Link to comment
Share on other sites

Link to post
Share on other sites

Apologies, but I don't know the C# libraries, but maybe this can help. It has source code too

AMD FX8350  2x ASUS Radeon R9 270X 4GB  ASUS Sabertooth 990FX  -  Crucial Ballistix Sport DDR3 16GB

Link to comment
Share on other sites

Link to post
Share on other sites

Check out this post on Stack Overflow, it may help :)

 

http://stackoverflow.com/questions/2416748/how-to-simulate-mouse-click-in-c

My Current Build: 

Intel i5 3570K @ 4.4GHz 1.11V, Cooler Master Hyper 212 EVO, Asrock Z77 Extreme4, Corsair Vengeance 8GB 1600MHz, Samsung 840 EVO 250GB, Asus GTX 760 DCII Overclocked, Corsair CX600M

Link to comment
Share on other sites

Link to post
Share on other sites

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Threading;namespace ConsoleApplication3{    class Program    {        static void Main(string[] args)        {            Thread mouseKlickThread = new Thread(new ThreadStart(MouseKlickThread));            mouseKlickThread.Start();                    }        public static void MouseKlickThread()        {            while (true)            {                //hier moet de linker klik functie nog                Console.WriteLine("5 seconds have passed");                Thread.Sleep(5000);            }                    }    }}

Case sensitive on .Start(); you originally put it as  start(); Also the Thread.Sleep(5000); must be inside of the while(true) loop, as it's looping forever it will never exit that loop. (no idea about clicking however). 

CPU: Intel 3570 GPUs: Nvidia GTX 660Ti Case: Fractal design Define R4  Storage: 1TB WD Caviar Black & 240GB Hyper X 3k SSD Sound: Custom One Pros Keyboard: Ducky Shine 4 Mouse: Logitech G500

 

Link to comment
Share on other sites

Link to post
Share on other sites

no , i want the program to auto click every 10 sec (leftclick)

Do you want it to click a button within the application, or have it work as a global auto clicker?

 

I'm just going to assume global, I've put together a sample project to lend you a hand. It uses "magic numbers," I assume that you'll be able to modify on your own if you'd like to change that.

I implemented it using a timer, since I think that is a better option than sleeping the thread. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×