How to control minecraft character by WinAPI?

NintyS 1 Reputation point
2021-02-26T17:32:23.497+00:00

Hello, I have a task to create a bot for minecraft for digging in the background. I'm new to WinAPI and I don't know what I was supposed to do. I create a HWND and I find a window, now when I try to PostMessage() to minecraft then the character does nothing, only in chat my messages are typed into the chat bar. I tried with Spy++ and sending messages to minecraft’s subwindows and still nothing. Anyone know what to do?

Windows development Windows API - Win32
Developer technologies C++
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 90,521 Reputation points
    2021-02-27T18:22:12.937+00:00

    You can use SendInput to simulate mouse and keyboard events
    But the window must be in foreground
    I tested with a demo version, to set it to foreground :

    HWND hWndDest = FindWindow(L"GLFW30", NULL);  
    SwitchToThisWindow(hWndDest, TRUE);  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.