I have such a clicker, I want to be able to continue, for example, after opening another application, or vice versa. Please help All code here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Klikacz____TzPw
{
public partial class Form1 : Form
{
\[DllImport(dllName: "User32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)\]
public static extern void mouse\_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
private const int LEFTUP = 0x0004;
private const int LEFTDOWN = 0x0002;
public Form1()
{
InitializeComponent();
this.ActiveControl = button1;
button1.Focus();
}
private void Click\_clock\_Tick(object sender, EventArgs e)
{
Random rnd = new Random();
int maxcps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 \* 0.2));
int mincps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 \* 0.4));
try
{
Click\_clock.Interval = rnd.Next(mincps, maxcps);
}
catch
{
//Ignored..
}
bool mousdown = MouseButtons == MouseButtons.Left;
if (mousdown)
{
mouse\_event(dwFlags: LEFTUP, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
Thread.Sleep(millisecondsTimeout: rnd.Next(1, 6));
mouse\_event(dwFlags: LEFTDOWN, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
}
}
private void button1\_Click(object sender, EventArgs e)
{
if (button1.Text.Contains("Uruchom"))
{
Click\_clock.Start();
button1.Text = "Wstrzymaj";
}
else
{
Click\_clock.Stop();
button1.Text = "Uruchom";
}
}
private void trackBar1\_Scroll(object sender, EventArgs e)
{
CPSValue.Text = "CPS = " + trackBar1.Value.ToString();
}
}
}