I am trying to emulate various tasks in Win7 and i have some problems with this function :
LeftMouseClick(Cursor.Position.X - 720, Cursor.Position.Y - 45);
System.Threading.Thread.Sleep(1000);
// Simulate each key stroke
InputSimulator.SimulateKeyDown(VirtualKeyCode.RETURN);
InputSimulator.SimulateKeyUp(VirtualKeyCode.RETURN);
InputSimulator.SimulateTextEntry("cmd");
System.Threading.Thread.Sleep(1000);
InputSimulator.SimulateKeyDown(VirtualKeyCode.RETURN);
InputSimulator.SimulateKeyUp(VirtualKeyCode.RETURN);
All i want to do is to press START, write cmd, hit enter. All works smooth except hitting the enter key.
All of this are happening on a RDP ActiveX, here is the code :
var client = (IMsRdpClient7)rdp.GetOcx();
// client.RemoteProgram2.RemoteProgramMode = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).DisplayConnectionBar = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).ConnectionBarShowPinButton = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).BitmapVirtualCache32BppSize = 48;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).ConnectionBarShowRestoreButton = false;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).ConnectionBarShowMinimizeButton = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).EnableWindowsKey = 1;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).GrabFocusOnConnect = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).RedirectDrives = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).RedirectClipboard = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).RedirectPrinters = true;
((MSTSCLib.IMsRdpClientAdvancedSettings5)rdp.AdvancedSettings).RedirectPOSDevices = true;
rdp.Server = "1.2.3.4";
rdp.UserName = "Rmlabuser2";
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = "Rmlabuser2";
// rdp.FullScreenTitle = "Full Screen";
// rdp.SecuredSettings.FullScreen = 1;
// rdp.SecuredSettings.StartProgram = "calc";
rdp.Connect();
I repeat, keys works, i cannot hit enter.
Thanks.