I'm trying to simulate the "Enter key" using SendInput(), it is working on all the scenario's like SignOut, Restart, Shutdown etc.., except Lock. Here's the code,
INPUT inputs[2] = { 0 };
ZeroMemory(inputs, sizeof(inputs));
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = VK_RETURN;
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = VK_RETURN;
inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
my question is, why it is not working on Lock Screen? If this has no way to work, then how can I reach my purpose? Does someone know whats the solution?