I am trying to send keystrokes to inactive Window (VLC Media Player). I am using C++
Below is the code I tried:
HWND hwndWindowTarget;
HWND hwndWindowVLC = FindWindow(NULL, L"VLC media player");
if (hwndWindowVLC)
{
// Find the target class window within VLC.
hwndWindowTarget = FindWindowEx(hwndWindowVLC, NULL, L"QWidget", NULL);
if (hwndWindowTarget)
{
PostMessage(hwndWindowTarget, WM_CHAR, 'P', 0);
}
}
It works well for Notepad. I do not know what's wrong. Most possibly is because of the window target name on the findwindowex.
I had used WinSpy++ to get the class name of VLC:
Please help me. Should you know what's wrong or what could be the name of the correct class window name for VLC, please give me a hint. Many thanks!