okay so I am trying to make a auto clicker that starts clicking when you hold the left mouse button down. And I got it to tell me when the user held down the left mouse button but the form was not click through able. I then made the form click-thru-able by adding
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
and
int initialStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);
this.TopMost = true;
but once I made it click-thru-able it did not tell me if the left mouse button was being held.
so basically i made a main form that the user controls and sets the click speed and stuff, then i made a second form that is the size of the screen and is top most and transparent so if you left clicked on the form it would read the mouse down function which i set to set a bool to true or false but once i made the form click-thru-able i guess it doesn't read the mouse down function.
here is the code on how it detects if the left mouse button is being held
private void Form2_MouseDown(object sender, MouseEventArgs e)
{
if (MouseButtons == MouseButtons.Left)
{
mousedownheld = true;
}
}
private void Form2_MouseUp(object sender, MouseEventArgs e)
{
mousedownheld = false;
mousedownheld2 = true;
}