Mouse Click?

Posts 115 of 15 · Page 1 of 1
Mouse Click?
How can you code a mouse click in game for a certain position?
What do you mean? Do you mean like, only allow the mouse action to be completed when the cursor is inside a box? Or just a mouse click?
I think he means to make the mouse click when it is a a certain X,Y position on your screen.
SendInput.
I think he wants to make, "autofire" .
first declare a point:

Code:
POINT position;
Then use the GetCursorPos Function to get the cursor position:

Code:
GetCursorPos(&position);
Afterwords come your if statements for the mouse click:

Code:
if(GetAsyncKeyState(VK_LEFT)<0){
if((position.x > boxminwidth) && (position.x < boxmaxwidth) && ( position.y > boxminheight) && ( position.y < boxmaxheight)) {
//ACTIONS HERE
}
}
-----------------------------------------------------
Edit: oh my bad I misread your reply. Above is for if you want to activate something when clicking inside a certain area /
Found this after 2 seconds of googling. I bet your homepage is google and you don't even know how or when to use it.

[php]
void LeftClick ( )
{
INPUT Input={0};
// left down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));

// left up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}

[/php]
Quote Originally Posted by Void View Post
Found this after 2 seconds of googling. I bet your homepage is google and you don't even know how or when to use it.

[php]
void LeftClick ( )
{
INPUT Input={0};
// left down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));

// left up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}

[/php]
I don't think he can understand us since he seems new to coding.
No, I need mouse to automatically click on a certain location.
Quote Originally Posted by ipwnuuaal5 View Post
No, I need mouse to automatically click on a certain location.
I think you should read over my 2 posts and don't judge too quickly. The structure used in the SendInput has more members, that include the x and y coordinates of the mouse.

You should really do some research on your own before posting here. It could really save us all the trouble of going through this meaningless attempt at helping someone that obviously doesn't know programming what so ever, if you did research before posting, you could've figured that out yourself.
ok thanks void.
i did my research

this is how you do it.
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
SetCursorPos(..)

or
mouse_event(...)

GetAsyncKeyState(VK_LBUTTON) = true;

Quote Originally Posted by topblast View Post
GetAsyncKeyState(VK_LBUTTON) = true;

You cannot SET the value in a GET statement.
Quote Originally Posted by ipwnuuaal5 View Post
How can you code a mouse click in game for a certain position?
SetCursorPos(x,y);

I think that is it. I havent use that since my color aimbot


Quote Originally Posted by freedompeace View Post
You cannot SET the value in a GET statement.
well what do u kno.. u learn something every day( i was just kidding i knew u could not do it like that)
Posts 115 of 15 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?