I'm trying to do a workaround for an app that doesn't have any command line options.
In this case, I would need to 'tab' to a checkbox, click it, then 'tab' to a 'start' button and click that - in a remote running process, that I spawned from my main program using ShellExecute, since CreateProcess would wait 'till it closed, which doesn't let me operate on it (which may not be possible, anyway).
Sounds like one of those 'You can't get there from here' situations.
Maybe this isn't a doable thing.
Maybe I'm not using SendInput correctly (after all, I have no experience with it).
But, MrAutoHotkey does it from his runtime, so I still hold out hope I can do this internally without resorting to any additional external processes ( himmel, I'm *already* an 'external' process! ).
There's no error message from SendInput.
But here's what appears on the command line after I exit:
C:\Programming\proto>"BlockInput function (winuser.h) - Win32 apps _ Microsoft Learn_files"
Which is a tab in my browser...
So it looks like SendInput is, indeed, working on at least *one* remote process...
Just not the one I want it to.
Here's what I do after the external program is up and running:
void robodim(void)
{
char buf[1024];
INPUT inputs[6] = {0};
ZeroMemory(inputs, sizeof(inputs));
//Press tab
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = VK_TAB;
//lift key
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = VK_TAB;
inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
//press tab agin
inputs[2].type = INPUT_KEYBOARD;
inputs[2].ki.wVk = VK_TAB;
//lift key
inputs[3].type = INPUT_KEYBOARD;
inputs[3].ki.wVk = VK_TAB;
inputs[3].ki.dwFlags = KEYEVENTF_KEYUP;
//press spacebar to check
inputs[4].type = INPUT_KEYBOARD;
inputs[4].ki.wVk = VK_SPACE;
//lift key
inputs[5].type = INPUT_KEYBOARD;
inputs[5].ki.wVk = VK_SPACE;
inputs[5].ki.dwFlags = KEYEVENTF_KEYUP;
UINT uSent = SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
if (uSent != ARRAYSIZE(inputs))
{
sprintf(buf,"SendInput failed: 0x%x\n", GetLastError());
MessageBox(NULL,buf,"",MB_OK);
}
}
After which I exit.
That's all I got, Thanks.