I am working on one project where I am sending Paste command to another application window using SendInput() As Follows:
`INPUT input, vButton, ctrl1, ctrl2;` input.type = INPUT_KEYBOARD; input.ki.wVk = VK_CONTROL; input.ki.wScan = 0; input.ki.dwFlags = KEYEVENTF_UNICODE ; input.ki.time = 0; input.ki.dwExtraInfo = 0; vButton .type = INPUT_KEYBOARD; vButton .ki.wVk = 0x56; vButton .ki.wScan =0; vButton .ki.dwFlags = KEYEVENTF_UNICODE ; vButton .ki.time = 0; vButton .ki.dwExtraInfo = 0; ctrl1.type = INPUT_KEYBOARD; ctrl1.ki.wVk = VK_CONTROL; ctrl1.ki.wScan = 0; ctrl1.ki.dwFlags = KEYEVENTF_KEYUP |KEYEVENTF_UNICODE ; ctrl1.ki.time = 0; ctrl1.ki.dwExtraInfo = 0; ctrl2.type = INPUT_KEYBOARD; ctrl2.ki.wVk = VK_TAB; ctrl2.ki.wScan = 0; ctrl2.ki.dwFlags = KEYEVENTF_KEYUP ; ctrl2.ki.time = 0; ctrl2.ki.dwExtraInfo = 0; // Send Input To Another Window ::ShowWindow(mainHwnd, SW_SHOWNORMAL); int retval = SendInput(1, &input, sizeof(INPUT)); retval = SendInput(1, &vButton, sizeof(INPUT)); retval = SendInput(1, &ctrl1, sizeof(INPUT)); retval = SendInput(1, &ctrl2, sizeof(INPUT));` It is working fine except INPUT having VK_TAB key. I want Send VK_TAB command to the application.
But it is not Working as Expected i.e. The next control is not getting focused even after successful completion of the SendInput().
Can anyone help me on this. How I can focus on next control of other application?
Thank You in Advance.
WM_NEXTDLGCTLmessage.