#include<Windows.h>
#include <iostream>
BOOL WINAPI Main(HMODULE hmodule)
{
int main;
{
int key, key2;
setlocale(LC_ALL, "Rus");
SetConsoleTitle("1"); // устанавливаем название заголовка консоли
system("color A"); // устанавливаем цвет шрифта
std::cout << "////////////////////////////////////////////////////////////////////////\n";
std::cout << "Водить число клавиши\n";
std::cout << "Доступные клавиши\n";
std::cout << "F1 = 112\n";
std::cout << "F2 = 113\n";
std::cout << "Tab = 9\n";
std::cout << "Enter = 13\n";
std::cout << "Shift = 16\n";
std::cout << "Ctrl= 17\n";
std::cout << "Alt = 18\n8";
std::cout << "CapsLock = 2\n0";
std::cout << "Esc = 27\n";
std::cout << "a A = 65\n";
std::cout << "b B = 66\n";
std::cout << "c C = 67\n";
std::cout << "d D = 68\n";
std::cout << "e E = 69\n";
std::cout << "f F = 70\n";
std::cout << "g G = 71\n";
std::cout << "h H = 72\n";
std::cout << "i I = 73\n";
std::cout << "j J = 74\n";
std::cout << "k K = 75\n";
std::cout << "l L = 76\n";
std::cout << "m M = 77\n";
std::cout << "n N = 78\n";
std::cout << "o O = 79\n";
std::cout << "p P = 80\n";
std::cout << "q Q = 81\n";
std::cout << "r R = 82\n";
std::cout << "s S = 83\n";
std::cout << "t T = 84\n";
std::cout << "u U = 85\n";
std::cout << "v V = 86\n";
std::cout << "w W = 87\n";
std::cout << "Ведите клавишу(left):";
std::cin >> key;
std::cout << "Ведите клавишу(right):";
std::cin >> key2;
while (1)
{
if (GetAsyncKeyState(key))
{
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, 0, 0);
}
else if (GetAsyncKeyState(key2))
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, NULL, NULL, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, NULL, NULL, 0, 0);
}
Sleep(1000);
}
return 0;
return true;
system("pause");
}
}
BOOL APIENTRY DllMain(HMODULE, DWORD Attach, LPVOID IpReserved)
{
switch (Attach)
{
case DLL_PROCESS_ATTACH:
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Main, 0, 0, 0);
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
При инжекте dll в программу должна открываться консоль с выбором клавиш, но она сразу же крашит
Как это исправить .
Заранее спасибо