#include <windows.h>
#include "stdio.h"
//#include "Defines.h"
#if(_WIN32_WINNT >= 0x0500)
#define KEYEVENTF_UNICODE 0x0004
#define KEYEVENTF_SCANCODE 0x0008
#endif _WIN32_WINNT >= 0x0500
//*********************************************************
// Aqui eu tou pressionando o botão.
static void SetInputDX(WORD input_code_set)
{
INPUT inp[1];
memset(inp, 0, sizeof(INPUT));
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.wScan = input_code_set;
inp[0].ki.dwExtraInfo = 0;
SendInput(1, inp, sizeof(INPUT));
}
//*********************************************************
// Aqui eu tou soltando o botão.
static void ReleaseInputDX(WORD input_code_release)
{
INPUT inp[1];
memset(inp, 0, sizeof(INPUT));
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.dwFlags |= KEYEVENTF_SCANCODE;
//inp[0].ki.dwFlags |= KEYEVENTF_KEYUP;
inp[0].ki.wScan = input_code_release;
inp[0].ki.dwExtraInfo = 0;
SendInput(1, inp, sizeof(INPUT));
}
void main() {
SetInputDX(0x45); // 0x45 = numlock key
ReleaseInputDX(0x45);
}