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 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
C++
C++
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
    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