How to control minecraft character by WinAPI?

NintyS 1 Reputation point

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 API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,481 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,601 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 82,491 Reputation points

    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