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?
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.
I think he wants to make, "autofire" .
first declare a point:
Then use the GetCursorPos Function to get the cursor position:Code:POINT position;
Afterwords come your if statements for the mouse click:Code:GetCursorPos(&position);
-----------------------------------------------------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 /
Last edited by CodeDemon; 08-27-2010 at 01:50 PM.
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]
topblast (08-27-2010)
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;
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
Last edited by topblast; 08-27-2010 at 05:49 PM.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development