troubleshooting Question

Remote App failed to launch using MSTSCLib API

Avatar of QUILLET
QUILLET asked on
Application Servers.NET App ServersMicrosoft Server Apps
1 Comment1 Solution5212 ViewsLast Modified:
Hi,

I am using MSRDPClient in a c# winform application and can't get to launch a remote app.
The following code is working for opening a desktop control if I comment out rdp.RemoteProgram.RemoteProgramMode = true;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AxMSTSCLib;

namespace SampleRDC
{
    public partial class Form1 : Form
    {
        // initialized in form1.Designer
        // private AxMSTSCLib.AxMsRdpClient7NotSafeForScripting rdp;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                rdp.Server = txtServer.Text;
                rdp.UserName = txtUserName.Text;

                rdp.OnConnected += new EventHandler(rdp_OnConnected);

                rdp.RemoteProgram.RemoteProgramMode = true;
                //rdp.RemoteProgram2.RemoteApplicationName = "Calculator";
                //rdp.RemoteProgram2.RemoteApplicationProgram = @"C:\Windows\system32\calc.exe";
                
                rdp.AdvancedSettings7.ClearTextPassword = txtPassword.Text;
                rdp.Connect();               

            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error Connecting", "Error connecting to remote desktop " + txtServer.Text + " Error:  " + Ex.Message,MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        void rdp_OnConnected(object sender, EventArgs e)
        {

            rdp.RemoteProgram.ServerStartProgram(@"C:\Windows\system32\calc.exe", "", "", false, "", false);
        }
   }
}

Trying to launch a remote app using :

rdp.RemoteProgram.RemoteProgramMode = true;
...
            rdp.RemoteProgram.ServerStartProgram(@"C:\Windows\system32\calc.exe", "", "", false, "", false);

nothing happens and the connected event is never fired.

The client dev environnment is VS 2010 on Windows 7 Pro SP1
The target environnement is WS2008R2,
The TS Server is WS2003

Thanks for helping me
ASKER CERTIFIED SOLUTION
QUILLET

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros