my program writes wasd123wasd123, but i dont know how to make it writing 1ws2aasd22ww. How to make random presser? Can someone help me?

#include <iostream>
#include <windows.h> 
#include <stdlib.h> 
using namespace std; 

int main () 
{ 
  for(;;){ 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('w'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('a'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('s'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('d'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('1'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('2'),0,0,0); 
  Sleep(1000); 
  rand(); 
  keybd_event(VkKeyScan('3'),0,0,0); 
  } 
  return 0; 
}

Recommended Answers

All 3 Replies

I'm confused. I dont know how to use array with keybd_event command. Can someone give me sample of source code with keybd_event?

We have no idea what you are talking about. Details and examples, please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.