I am trying to send a string of data to a remote Terminal Server session via
the ActiveX client. I can start the session login or logout okay but I
can't send data very well. I can send any data that is a "single key
stroke" meaning that if I send the letter "A" or the letter "a", I always
get "a". I don't understand how to send the shift keys or control keys. Is
this the correct interface? I would like to use this interface because it
does not get user input mixed in with it's key strokes. If I send...
"@#$", I get "234". So, what is the proper way to use this interface to
send mixed case data...
Here is information on the interface I am trying to use...
IMsRdpClientNonScriptable::SendKeys
Sends a series of keystrokes to the Remote Desktop ActiveX control. The
keystrokes are in scan code form, which is the keyboard data from the actual
physical keys. This interface was added for Windows XP.
HRESULT SendKeys(
LONG numKeys,
VARIANT_BOOL* pbArrayKeyUp,
LONG* plKeyData
);
Parameters
numKeys
[in] The number of keystrokes to send. The maximum number of keys that can
be sent in one operation is 20. The method returns E_INVALIDARG if this
parameter is greater than 20. For more information, see the following
Remarks section.
pbArrayKeyUp
[in] An array whose size is equal to numKeys. An element is TRUE if the
corresponding key is UP and FALSE if the corresponding key is DOWN.
plKeyData
[in] An array whose size is equal to numKeys. The array contains keystroke
data and corresponds to the value of the lParam parameter of the WM_KEYDOWN
message. The data specifies the repeat count, scan code, extended-key flag,
context code, previous key-state flag, and transition-state flag. For a
description of the bits in this array, see WM_KEYDOWN.
The corresponding element in pbArrayKeyUp indicates if the key is UP or
DOWN.
Return Values
Return S_OK if successful.
Return a nonzero error code if an error occurs.
Remarks
The SendKeys method does not mix keystrokes made by the local user with
keystrokes that the method is sending. All keystrokes passed to the method
are sent to the remote session in a single atomic sequence.
For requirements information, see Requirements for Remote Desktop Web
Connection.
See Also