ok so im Trying to send Keys, in this case Mouse button, but when its injected ect it wont send? any help would be good, thanks.
#define IsKeyDown(Key) GetAsyncKeyState(Key) & 0x8000 //Used to check if a key is down.
#include <windows.h>
#include <iostream>
#include <tchar.h>
#pragma comment(lib,"User32.lib")
using namespace std;
DWORD dwGameExe = NULL;
bool bFire = false;
bool on1 = true;
DWORD WINAPI dwMainThread(LPVOID)
{
for(;dwGameExe == NULL; Sleep(250)); {
dwGameExe = (DWORD)GetModuleHandle("notepad.exe"); }
if (IsKeyDown(VK_F2))
on1 = !on1;
if(on1 == true)
{
Sleep(100);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(100);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(100);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(100);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
return 1;
}
if(GetAsyncKeyState(VK_UP)&1) bFire = !bFire;
if(bFire == true)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(2500);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
MessageBox(NULL,"Project1.dll detached to Process!", "Successful Injection" ,NULL);
}
return 1;
}
BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
CreateThread(0,0,dwMainThread,0,0,0);
MessageBox(NULL,"Project1.dll detached to Process!", "Successful Injection" ,NULL);
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}