Mouse Clicking

Hey, so I just was making a program that basically makes the mouse click, cause i thought it would be cool to get a few thousand clicks on that facebook clicking game. The code I have right now is the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <windows.h>
#include <conio.h>

using namespace std;

int main(){
    SetCursorPos(100, 400);
    for(int i=0; i<200000; ++i)
    {
    mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);}
    return 0;
}    


What I was thinking is instead of doing ++i to simply make this function execute for 30 seconds. I figured this might allow me to get more clicks (is that even true?) and that way it would stop clicking after 30 seconds. However, I don't really have an idea how to go about this... I did some searching and came across the time_t function but don't really know how to incorporate it from there. Help as always is greatly appreciated :)
Off topic and of no help but I want to add. Just about an hour ago I saw the clicking game on Facebook and this was the first thing that came to my mind.
GetTickCount() returns the number of milliseconds the program has been running.
Topic archived. No new replies allowed.