Winform 内的托管 RemoteAPP

满上 2015-04-15 03:31:50
rdp.Server = "192.168.1.173";
rdp.AdvancedSettings2.RDPPort = 3389;
rdp.UserName = "administrator";
rdp.AdvancedSettings8.ClearTextPassword = "aaa";

rdp.AdvancedSettings8.RedirectDrives = false;//映射驱动
rdp.AdvancedSettings8.RedirectPrinters = true;//映射打印
rdp.RemoteProgram.RemoteProgramMode = true;//远程接入
rdp.AdvancedSettings8.SmartSizing = true;//自动缩放

rdp.Connect();
rdp.RemoteProgram.ServerStartProgram(@"%SYSTEMROOT%\notepad.exe", "", "%SYSTEMROOT%", true, "", false);
--上面这段话有人说放到connect前面,都试过,Win窗口打开了,没调打开程序,
高手们帮帮忙,或给个例 子,非常 感谢
...全文
389 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
quchao 2017-02-22
  • 打赏
  • 举报
回复
用这两属性立马就好用,可以测试下
rdp.SecuredSettings.StartProgram = @"D:\Pro\test.exe";
rdp.SecuredSettings.WorkDir = @"d:\Pro";
sanguozhiggg 2015-06-05
  • 打赏
  • 举报
回复
bool CVirtualAppDlg::ConnectToMstscApp() { int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); m_rdp.put_DesktopHeight(height); m_rdp.put_DesktopWidth(width); CMsRdpClientAdvancedSettings6 m_MsRdpClientAdvancedSettings(m_rdp.get_AdvancedSettings()); m_rdp.put_UserName("Administrator"); //登陆用户名 m_rdp.put_Server("192.168.7.173");//远程目标主机的IP m_rdp.put_ColorDepth(32); m_MsRdpClientAdvancedSettings.put_Compress(1); m_MsRdpClientAdvancedSettings.put_BitmapPeristence(1); m_MsRdpClientAdvancedSettings.put_ClearTextPassword("Aa123!");//登陆密码 m_MsRdpClientAdvancedSettings.put_RDPPort(3389); m_MsRdpClientAdvancedSettings.put_singleConnectionTimeout(5);//连接时延 m_rdp.Connect(); return true; } void CVirtualAppDlg::OnConnectedMstscax1() { m_TSRemoteProgram2.put_RemoteProgramMode(TRUE); m_TSRemoteProgram2.ServerStartProgram("C:\\Windows\\System32\\calc.exe","","C:\\Windows\\System32",VARIANT_TRUE,NULL,VARIANT_FALSE); } 各位:我把ServerStartProgram放到了OnConnectedMstscax1中也不能打开虚拟应用,请问什么问题? 在此之前将ServerStartProgram放到了m_rdp.Connect();之前也是不行。
地上的一坨泥 2015-05-03
  • 打赏
  • 举报
回复
1:完整示例代码: //rdp_program 为AxMsRdpClient6NotSafeForScripting类型 rdp_program.Dock = DockStyle.Fill; rdp_program.Server = ""; rdp_program.UserName = ""; //IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp_program.GetOcx(); //secured.ClearTextPassword = textPass.Text; //secured.ClearTextPassword = "123"; //rdp_program.SecuredSettings.StartProgram = "%SYSTEMROOT%\\System32\\notepad.exe"; // rdp_program.SecuredSettings.WorkDir = "%SYSTEMROOT%"; rdp_program.AdvancedSettings6.ClearTextPassword = ""; rdp_program.RemoteProgram.RemoteProgramMode = true; //rdp_program.AdvancedSettings6.RedirectDrives = true; // rdp_program.AdvancedSettings6. rdp_program.OnConnected += (_1, _2) => { rdp_program.RemoteProgram.ServerStartProgram(@"%SYSTEMROOT%\\System32\\notepad.exe", "", "%SYSTEMROOT%", true, "", false); }; //rdp_program.RemoteProgram.ServerStartProgram(@"%SYSTEMROOT%\notepad.exe", "", "%SYSTEMROOT%", true, "", false); //rdp_program.OnConnected= rdp_program.AdvancedSettings6.PublicMode = false; rdp_program.DesktopWidth = SystemInformation.VirtualScreen.Width; rdp_program.DesktopHeight = SystemInformation.VirtualScreen.Height; //rdp_program.AdvancedSettings6.AuthenticationLevel = 3; rdp_program.AdvancedSettings6.SmartSizing = true; rdp_program.Connect(); 2:要把你想打开的程序添加到允许远程程序连接管理的列表中,win 2008 server有这个服务,win7没有这个服务 win7解决方式:http://drtritsch.com/2011/08/remoteapp-on-windows-7-2 win 2008 server解决方式: Click Start, point to Administrative Tools, point to Remote Desktop Services, and then click RemoteApp Manager. In the Action pane, click Add RemoteApp Programs. On the Welcome to the RemoteApp Wizard page, click Next. On the Choose programs to add to the RemoteApp Program list page, select the Calculator check box, and then click Next. On the Review Settings page, click Finish.

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧