SetWindowsHookEx() WM_KEYBOARD_LL not coming through with full screen RDC

会有一股神秘感。 提交于 2019-11-30 16:08:55

Have a look at GetLastInputInfo(). Try calling that periodically.

Yes. You'll not get keys pressed in remote desktop. I had this problem and only solution I found was this:

Using FindWindow API always look to find RDP window, if you've detected that full-screen RDP window has been created you should do this:

a) Unhook all hooks. b) Reset all hooks.

So create a function which makes SetWindowHookEx API calls and call it SetHook and another one as UnHook function. Then re-call both of them anytime you find out user get into remote desktop.

Now you can get keys pressed even inside remote desktop connection.

I found my old code, I did something like this:

Created a timer with 1 sec. Then

std::string tmp;
HWND hParent = ::FindWindow(TEXT("TSHELLHWND"), NULL);
GetWindowString(hParent, tmp);

ix = za.find(" - Remote Desktop");

if (hParent != NULL && ix != string::npos)
RestartHook();

You also should have a global variable to set when you've restarted hook, otherwise all the time it will restart the hook. When window closed, you can reset that global variable.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!