#Question about simulating input

3 messages · Page 1 of 1 (latest)

subtle marlin
#

So I am making a macro specifically for bluestacks (mobile game emulator). I know that they have built in "macros" or whatever but I am trying to make mine go much further. Anyway the question that I have is that for the life of me I can't simulate keypress or mouse events in bluestacks. The code works in other applications but for some reason it doesn't interact with bluestacks.

#

here is my most recent code:

`void SimulateKeyPress(HWND window, int keyCode) {
// Get the thread ID and attach the input to the thread
DWORD threadID = GetWindowThreadProcessId(window, NULL);
AttachThreadInput(GetCurrentThreadId(), threadID, TRUE);

// Set the key state and type
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = keyCode;
input.ki.dwFlags = 0;

// Send the key press event
SendInput(1, &input, sizeof(INPUT));

// Release the key
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &input, sizeof(INPUT));

// Detach the input from the thread
AttachThreadInput(GetCurrentThreadId(), threadID, FALSE);

}`

#

with the function call for example: SimulateKeyPress(window, '1');