Raiden616
Raiden616

Reputation: 1562

keybd_event() calls not sending to remote desktop

I am trying to use keybd_event() to press certain keys through to a remote desktop application. For the simplest test I am simply opening notepad in the remote session, and have the call keybd_event() run on the local computer with the current user focus on notepad.

Unfortunately it does not appear to be sending any input through to remote desktop.

If I run the application on the local computer with a local instance of notepad in focus, it types exactly what I want to type no problem.

Does anyone have any ideas why this won't work? Obviously I can type manually into the remote desktop session.

Thanks

Upvotes: 2

Views: 898

Answers (1)

Ajay
Ajay

Reputation: 18411

Any Remote Desktop program is a gateway to connect a remote system, it is a mediator. Sending any keyboard message to this program via any method (like keybd_event, SendInput, PostMessage etc.) will be silently absorbed by the RDP program. It simply wont consume it, and wont pass it to the connected resource.

Most probably (which I am not sure of), the program might have documented APIs to send some messages to it, like close-session, open-session, or to send-message-to-connected session. Using given API (function, COM interfaces whatsoever), you may send some input to connected resource.

Upvotes: 1

Related Questions