Page 1 of 1

Make mouse click

Posted: Sat Aug 23, 2008 4:59 pm
by mr_penguin
Does anyone know how to make it so when you click the mouse its like the mouse is constantly clicking like at 20 clicks a second or something.

Posted: Sat Aug 23, 2008 6:33 pm
by xzodia
Why would you want to do that?

Posted: Sat Aug 23, 2008 7:22 pm
by CompKronos
probably a trainer or something similar to have auto fire with a weapon that doesn't have it.

Posted: Sun Aug 24, 2008 1:51 am
by Patrickssj6
Wow people, just answer :roll:

It's not like you are the only persons in the world he could ask.

Code: Select all

[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);

        private const int MOUSEEVENTF_LEFTDOWN = 0x02;
        private const int MOUSEEVENTF_LEFTUP = 0x04;
        private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
        private const int MOUSEEVENTF_RIGHTUP = 0x10;

Code: Select all

public void DoMouseClick()
        {
            //Call the imported function with the cursor's current position
            int X = Cursor.Position.X;
            int Y = Cursor.Position.Y;
            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
        }

Posted: Sun Aug 24, 2008 4:41 am
by xzodia
It was more that I thought there might have been a better way to achieve his goal depending on what it was...

Posted: Sun Aug 24, 2008 8:36 pm
by mr_penguin
thanks

Wait, is this C# or C++ because dllimports keeps giving me an error:

Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Logan\Local Settings\Application Data\Temporary Projects\Auto Click\Form1.cs 21 10 Auto Click

Posted: Mon Aug 25, 2008 10:23 pm
by LuxuriousMeat
mr_penguin wrote:thanks

Wait, is this C# or C++ because dllimports keeps giving me an error:

Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Logan\Local Settings\Application Data\Temporary Projects\Auto Click\Form1.cs 21 10 Auto Click
Put this at the top of your code file.

Code: Select all

using System.Runtime.InteropServices;

Posted: Tue Aug 26, 2008 2:12 am
by kornman00
I would suggest you sharpen up your interop skills, mouse_event's parameters are all uint based. long is a no-no, especially for the last parameter which is a pointer which in mouse_event's case is 32bit.

Posted: Thu Aug 28, 2008 11:06 am
by Patrickssj6
kornman00 wrote:I would suggest you sharpen up your interop skills, mouse_event's parameters are all uint based. long is a no-no, especially for the last parameter which is a pointer which in mouse_event's case is 32bit.
I copy pasted it from a website and didn't check up with MSDN. Didn't even notice that the params were all long. :wink: