Is the MsRdpClient11NotSafeForScripting::SendKeys() method broken or disabled on Windows11? All the other API calls work except this one. I am bit encoding the fields for the lParam, and have tried both bool and VARIANT_BOOL to indicate keys up/down.

R Hartley 0 Reputation points
2025-11-05T06:46:05.5233333+00:00

I am using the MsRdpClient11NotSafeForScripting class to write a C++ RDP client.

All the other needed functions/methods work except SendKeys().

I need to know if it is known broken / disabled on Windows 11 method broken or disabled on Windows11?

I use a bitfield to encode the fields for the "lParam", and have tried both bool and VARIANT_BOOL to indicate keys up/down, with various ways of casting to get the data references through.

Windows development | Windows API - Win32
{count} votes

1 answer

Sort by: Most helpful
  1. Tom Tran (WICLOUD CORPORATION) 3,115 Reputation points Microsoft External Staff Moderator
    2025-11-05T08:49:49.3066667+00:00

    Hi @R Hartley , Thanks for the details!

    is SendKey() broken or disable?

    I don't think SendKeys() is broken or disabled on Windows 11. Since it is still supported in the current RDP ActiveX control in the document (MsRdpClient11NotSafeForScripting class).

    If the method appears to do nothing, it’s usually due to how the parameters are passed rather than an OS issue.

    You can check a few things to see if it meets the requirement:

    • Ensure the session is fully connected and the control has focus before calling SendKeys. (See Keyboard Input Overview)
    • Use VARIANT_BOOL values (VARIANT_TRUE / VARIANT_FALSE) for the key up/down array.
    • For Windows key combinations (like Win + L or Alt + Tab), confirm the “Apply Windows key combinations” setting is configured to send them to the remote session. See: KeyboardHookMode property.
    • For security reasons, sequences like Ctrl + Alt + Del can’t be sent programmatically; use Ctrl + Alt + End instead. See Terminal Services Shortcut Keys.
    • ALT-based shortcuts may require the remote app to see them as system keys, which depends on the context bit in the key data. (See WM_SYSKEYDOWN)

    Hope this helps! If you still have any questions, please feel free to comment below. I'll be happy to assist you!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.