Mouse_Left - any way to emulate?

Posted By: Dooley

Mouse_Left - any way to emulate? - 05/05/20 19:04

I think this is something that should be easy, and I am somehow just missing it ... or it's something so difficult that I would have to write some kind of custom dll to get it to happen.

Is there an way to emulate a mouse click? I can move the mouse pointer with a controller, but I cannot make it so it can click on buttons.

I actually used this code:
Code
if(joy_1)
{
     mouse_left = 1;
}


I know it's not meant to be used that way, but surprisingly it did not crash, and the mouse buttons did respond to it, but just the buttons, it did not call the function.

Posted By: alibaba

Re: Mouse_Left - any way to emulate? - 05/05/20 21:20

Just include windows.h and use these lines

Code
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
wait(1); //this is mandatory
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);


Posted By: Dooley

Re: Mouse_Left - any way to emulate? - 05/06/20 03:25

Oh, awesome! Thanks for that. I have never been able to wrap my head around that windows.h thing fully. I should get used to looking into it.
© 2024 lite-C Forums