Hello,
I'm trying to create windows form application that allows a user to connect to a virtual machine. I have implemented VCL
http://vcl.apache.org/ and users are allowed to download the rdp file but I would like to automate it so when they click connect(in vcl php interface. ( I believe I need to create a uri in registry so the browser knows to call my windows form program to handle rdp protocol) RDP automatically connects them to the vm with the temporary password and username. I have some example code below. Eventually I'm going to parse the URI and pass those parameters. My question is what happens if the client is using Windows XP will the rdp control v8(AxMSTSCLib.AxMsRdpClient8NotSafeForScripting) work? what's the best approach for what I'm trying to accomplish. Any help in getting me started is appreciated.
private void button1_Click(object sender, EventArgs e) { Uri uri; uri = new Uri("rdp://username:password@10.10.11.63?forwardDisks=yes&forwardPrinters=yes&forwardSerial=yes&forwardAudio=yes&drawDesktop=yes&title=VCL%20Reservation&screenWidth=1280&screenHeight=1024"); Console.WriteLine(uri.UserInfo); Console.WriteLine("Fully Escaped {0}", uri.UserEscaped ? "yes" : "no"); rdp.Server = "10.10.11.63"; rdp.UserName = "username"; rdp.AdvancedSettings9.ClearTextPassword = "9TSDSw"; rdp.AdvancedSettings9.RedirectDrives = true; rdp.Connect(); }
Here is some more generated code.
namespace VCLConnect { partial class RDPWindow { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RDPWindow)); this.connect = new System.Windows.Forms.Button(); this.rdp = new AxMSTSCLib.AxMsRdpClient8NotSafeForScripting(); ((System.ComponentModel.ISupportInitialize)(this.rdp)).BeginInit(); this.SuspendLayout(); // // connect // this.connect.Location = new System.Drawing.Point(12, 596); this.connect.Name = "connect"; this.connect.Size = new System.Drawing.Size(75, 23); this.connect.TabIndex = 1; this.connect.Text = "Connect"; this.connect.UseVisualStyleBackColor = true; this.connect.Click += new System.EventHandler(this.button1_Click); // // rdp // this.rdp.Enabled = true; this.rdp.Location = new System.Drawing.Point(12, 12); this.rdp.Name = "rdp"; this.rdp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("rdp.OcxState"))); this.rdp.Size = new System.Drawing.Size(1172, 578); this.rdp.TabIndex = 2; this.rdp.OnConnecting += new System.EventHandler(this.axMsRdpClient8NotSafeForScripting1_OnConnecting); // // RDPWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1196, 631); this.Controls.Add(this.rdp); this.Controls.Add(this.connect); this.Name = "RDPWindow"; this.Text = "Remote Desktop Connection"; ((System.ComponentModel.ISupportInitialize)(this.rdp)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Button connect; private AxMSTSCLib.AxMsRdpClient8NotSafeForScripting rdp; }