unholii
N00b!!1

Posts: 10
|
 |
« on: July 11, 2009, 07:50:40 PM » |
|
Hey everyone I'm new in here and i want to know how to simulate left mouse click when right mouse button is pressed  I have tried google to find and there i found void SimulateMouseClick(int x, int y, MouseButton button); But it's not working  Well my code is atm #include <iostream> #include <windows.h> #include <time.h>
using namespace std;
int main() { char cMan; switch (cMan) { case 'VM_RBUTTONDOWN': do { void SimulateMouseClick(int x, int y, MouseButton button); sleep(250); }while(WM_RBUTTONDOWN == true) } return EXIT_SUCCESS; }
And my goal is to make a program what will autoclick every 250 millisecond until i release right mouse button.
|
|
|
|
« Last Edit: July 11, 2009, 07:52:25 PM by unholii »
|
Logged
|
|
|
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #2 on: July 12, 2009, 10:06:38 AM » |
|
Thanks for the site, and i found the SimulateMouseClick from google. I don't remember what site.
|
|
|
|
|
Logged
|
|
|
|
FrozenKnight
ASM Freak
Global Moderator
Dr. of C++ology
    
Posts: 546
Do it yourself it's the only way to learn.
|
 |
« Reply #3 on: July 12, 2009, 06:30:43 PM » |
|
I simulate mouse clicks by using windows messages. WM_CLICK, BM_CLICK i think right mouse is WM_RCLICK but i'll have to look that up.
|
|
|
|
|
Logged
|
 Imagine the impossible, then make it happen.
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #4 on: July 14, 2009, 05:45:50 AM » |
|
Could someone paste me whole code  Because i'm not sure anymore how it could be done 
|
|
|
|
|
Logged
|
|
|
|
|
oulyt
|
 |
« Reply #5 on: July 14, 2009, 04:07:46 PM » |
|
well read up on it and stuff. we are here to help not give answers
|
|
|
|
|
Logged
|
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #6 on: July 15, 2009, 04:52:15 AM » |
|
well read up on it and stuff. we are here to help not give answers
Heh ok  I've been very busy lately so i didn't have enough time to try to fix it and now i am sick. I will start trying now those links and things. But i hope i will succeed some day  .
|
|
|
|
|
Logged
|
|
|
|
FrozenKnight
ASM Freak
Global Moderator
Dr. of C++ology
    
Posts: 546
Do it yourself it's the only way to learn.
|
 |
« Reply #7 on: July 18, 2009, 02:16:43 AM » |
|
the messages approach is quite simple you just use SendMessage or PostMessage to the window you want to receive the click. (note some windows use mouse messages rather than mouse clicks. if you need the mouse to be at a specific spot when the click is received you can use SetCursorPos or SetPhysicalCursorPos to move the cursor to that location.
Sorry, i lost the example program i used to test this method in a HD crash a while back. but trust me i have used it and it does work, you should be able to look these functions up on MSDN. As for the messages you can just look them up in just about any example program that accepts mouse clicks of the type you are trying to emulate.
|
|
|
|
|
Logged
|
 Imagine the impossible, then make it happen.
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #8 on: August 09, 2009, 06:37:14 PM » |
|
HAHAA. Thanks anyways BUT I GOT IT WORKING !!! But its still not working as i wanted ... #include <cstdlib> #include <iostream> #include <windows.h> #include <stdlib.h> using namespace std; int main() { system("TITLE ChickenFriend autoclicker"); cout << "Welcome!" << endl; cout << endl << "Press F9 to start autoclicking and press F9 again to stop it" << endl; cout << endl << "Have fun :) " << endl; for(;;){ if(GetKeyState(VK_F9) == 1){ mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); Sleep(250); } } system("PAUSE"); return 0; }
And i don't know how to make it autoclick only when F9 is down. and stop when its up. ^^ If you can help with that, i would be glad 
|
|
|
|
« Last Edit: August 09, 2009, 07:47:00 PM by unholii »
|
Logged
|
|
|
|
|
*brammie*
|
 |
« Reply #9 on: August 09, 2009, 08:37:51 PM » |
|
if(GetKeyState(VK_F9) == 1)
replace that with:
if(GetKeyState(VK_F9))
|
|
|
|
|
Logged
|
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #10 on: August 21, 2009, 06:01:37 PM » |
|
if(GetKeyState(VK_F9) == 1)
replace that with:
if(GetKeyState(VK_F9))
Didnt work :s It stilll autoclicks until i press F9 again :< Does anybody have any idea how to make it to autoclick when F9 is down and its stops when its up  If you understand  EDIT____________ Ok i got some help from mIRC. Its perfect now #include <cstdlib> #include <iostream> #include <windows.h> #include <stdlib.h> using namespace std; int main() { int a = 0; system("TITLE ChickenFriend autoclicker"); for(;;){ if(GetAsyncKeyState(VK_F9)){ mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 5, 5); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 5, 5); a++; Sleep(250); }else{ cout << "Welcome!" << endl; cout << endl << "Press F9 to start autoclicking and press F9 again to stop it" << endl; cout << endl << "Have fun :) " << endl; cout << endl << endl; cout << "Autoclicked " << a << " times total." << endl; Sleep(1000); system("CLS"); } Sleep(25);
} system("PAUSE"); return 0; }
|
|
|
|
« Last Edit: August 21, 2009, 07:08:29 PM by unholii »
|
Logged
|
|
|
|
FrozenKnight
ASM Freak
Global Moderator
Dr. of C++ology
    
Posts: 546
Do it yourself it's the only way to learn.
|
 |
« Reply #11 on: August 22, 2009, 03:44:58 AM » |
|
There are many ways to do this one is to have your autoclicks inside a separate function that you call whenever a variable is set in your main loop. then you set/clear this variable based on the state of VK_F9.
|
|
|
|
|
Logged
|
 Imagine the impossible, then make it happen.
|
|
|
unholii
N00b!!1

Posts: 10
|
 |
« Reply #12 on: August 23, 2009, 01:21:37 PM » |
|
There are many ways to do this one is to have your autoclicks inside a separate function that you call whenever a variable is set in your main loop. then you set/clear this variable based on the state of VK_F9.
I didn't understand anything but there is one advice for anyone who's trying to make autoclicker, Remember to always put a delay for VK_F9 checking because otherwice it will raise your cpu because its trying to check the VK_F9 as fast as possible, so around 5-10 milliseconds 
|
|
|
|
|
Logged
|
|
|
|
FrozenKnight
ASM Freak
Global Moderator
Dr. of C++ology
    
Posts: 546
Do it yourself it's the only way to learn.
|
 |
« Reply #13 on: August 23, 2009, 06:28:59 PM » |
|
Please more my post above. I have successful created auto-clickers using the messages approach. And most auto-clickers I have seen have used hotkeys to manage the auto-clicking on and off.
|
|
|
|
|
Logged
|
 Imagine the impossible, then make it happen.
|
|
|
|