#include <stdlib.h>
#include <windows.h> // Include Windows API

/** Cheater Key Stroker (For Tiny Key Counter)
 * windows.h - Define for keyb_event.
 * Coder: Newt
 *  v1.0 - 27/Nov/2004
 *  v1.1 -  3/Dec/2004 - O printf de cada 'i' é usado para limitar a velocidade de execução do programa.
 *                       Caso isto não seja feito o programa entra em 'overspeed' e o Tiny Key Count
 *                       não consegue apanhar todos os strokes,
 *                       pelo menos de acordo com os testes que fiz.
 */

void start_delay(int); //Faz uma espera de N segundos com output segundo a segundo.

int main() {
 int i,x;
 printf("Max Strokes = max int number\nStrokes=");
 scanf("%d",&x);
 if (x < 1) return 0;
 
 start_delay(5);
 
 for(i=1 ; i <= x ; i++ ) {
   keybd_event('A', 0, 0, 0);               // Press key A down
   keybd_event('A', 0, KEYEVENTF_KEYUP, 0); // Release key A
   printf("%d\n",i);
 }
 return 1;
}


void start_delay(int n) {
 int i;
 for(i=n ; i > 0 ; i--) {
   printf("-> %ds to go.\n",i);
   sleep(1000);
 }
 printf("Started!\n");
} 
