1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <iostream.h>
#include <windows.h>
#include <winable.h>
using namespace std;
HWND janela=FindWindow(0, "Untitled - Notepad");
void GenerateKey(int vk, BOOL bExtended)
{
KEYBDINPUT kb = {0};
INPUT Input = {0};
/* Generate a "key down" */
if (bExtended) { kb.dwFlags = KEYEVENTF_EXTENDEDKEY; }
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1, &Input, sizeof(Input));
/* Generate a "key up" */
ZeroMemory(&kb, sizeof(KEYBDINPUT));
ZeroMemory(&Input, sizeof(INPUT));
kb.dwFlags = KEYEVENTF_KEYUP;
if (bExtended) { kb.dwFlags |= KEYEVENTF_EXTENDEDKEY; }
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1, &Input, sizeof(Input));
return;
}
#define shift 0x10
#define enter 0x0D
#define po 0x39
#define pc 0x30
#define co 0xDB
#define cc 0xDD
int main()
{
SetForegroundWindow(janela);
GenerateKey('I', FALSE);
GenerateKey('N', FALSE);
GenerateKey('T', FALSE);
GenerateKey(' ', FALSE);
GenerateKey('M', FALSE);
GenerateKey('A', FALSE);
GenerateKey('I', FALSE);
GenerateKey('N', FALSE);
GenerateKey(po, FALSE);
GenerateKey(pc, FALSE);
GenerateKey(enter, FALSE);;
GenerateKey(co, FALSE);
GenerateKey(enter, FALSE);
GenerateKey(cc, FALSE);
system("PAUSE");
return 0;
}
|