SendMessage 100% Virtual

Good staff late, I am new to the forum and am seeking some clarification on the SendMessage

Well first let me explain my problem.

Well, I'm creating a macro to click on some items to a game (Digimon Masters) however I am finding some difficulties

First thing I did was get his handle

HWND DMOWindow = FindWindow(0, "DMO");

When I try to use direct SendMessage in Handle, I could not run the hotkey that wanted
PostMessage(DMOWindow, WM_KEYDOWN, 0x31, 0x00020001);

So after some research I found out I needed to get the children of the main Handler

BOOL CALLBACK printChildId(HWND child, LPARAM param)
{
int childId = GetDlgCtrlID(child);
printf("ID: %d\n", childId);
return true;
}

EnumChildWindows(DMOWindow, printChildId, 1);

Output:

// Printf: ID: 1831

And with this ID i make

HWND GameWindow = GetDlgItem(DMOWindow, 1831);

The Only Children I could get was with the ID 1831, and he is the chat ID in the game.

This child I can write and perform some keys, but not What do I need, for children within that I can not perform the keys I need.

So I wonder if there are other ways I identify the children that I need to send the sendmessage, or even other ways to simulate mouse and keyboard with the background program (No mess up the mouse and main keyboard)
See:

SendInput
https://msdn.microsoft.com/en-us/library/ms911051.aspx
keybd_event
https://msdn.microsoft.com/en-us/library/ms909643.aspx
PostKeybdMessage
https://msdn.microsoft.com/en-us/library/ms910657.aspx


They will send the message to the windows that has the focus/is active.
@coder777, your suggestion does solve my problems, I need to send message to a specific window,
Topic archived. No new replies allowed.