在WinForm的托管RemoteApp会话 [英] Hosting RemoteAPP session within Winform

查看:1476
本文介绍了在WinForm的托管RemoteApp会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请回来这一点,并不能看着办吧......我创建工作的一个应用程序,基本上编译所有的我们的工具到一个更易于使用的GUI。其中一个我们使用的工具是我们从第三方使用的东西和托管为通过RDWeb远程应用程序。现在我也有只是普通的远程桌面访问,以及和我可以通过使用MSTSC我的Winform和的这个过程它精美的作品。我很好奇,如果有可能只是加载远程应用而不是整个桌面的MSTSC控制,以使我的用户没有得到充分的桌面。或者,如果有任何其他的方式来承载仅在一个的WinForms的RemoteApp。

Keep coming back to this and cannot figure it out... I am creating an app for work that essentially compiles all of our tools into one easier to use GUI. One of the tools we use is something we use from a 3rd party and is hosted as a Remote App via RDWeb. Now I also have just regular remote desktop access as well and I can access the desktop via my Winform using MSTSC and this process which works beautifully. I am curious if it is possible to just load the RemoteAPP and not the entire desktop in the MSTSC control so that my users aren't getting to the full desktop. Or if there is any other way to host a RemoteAPP Only within Winforms.

我已检讨的 ITSRemoteProgram 但是当我尝试以下方法,它只是抛出一个exception.The调试器停在 rdp.RemoteProgram.RemoteProgramMode = TRUE; 并给出了一个HRESULT E_FAIL例外。

I have reviewed the MSDN documentation on ITSRemoteProgram but when I try the following it just throws an exception.The debugger stops at rdp.RemoteProgram.RemoteProgramMode = true; and gives an HRESULT E_FAIL exception.

我已经使用也试过 remoteprogram 的OnConnected事件触发后,我也得到了同样的结果。

I have also tried using the remoteprogram after the OnConnected event fires and I get the same results.

try
{
    rdp.Server = "FFWIN2008R2DC.fflab123.net";
    rdp.Domain = "fflab123";
    rdp.UserName = "administrator";
    IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
    secured.ClearTextPassword = "password123";
    rdp.OnConnected += rdp_OnConnected;
    rdp.RemoteProgram.RemoteProgramMode = true;
    rdp.RemoteProgram2.RemoteApplicationName = "Calculator";
    rdp.RemoteProgram2.RemoteApplicationProgram = @"C:\Windows\system32\calc.exe";

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



也许我会在这个错误的方式或者它甚至没有可能。我只是想以正确的方向我不需要任何人来写这对我来说是微调。

Perhaps I am going at this the wrong way or perhaps its not even possible. I would just like a nudge in the correct direction I dont need anyone to write this for me.

推荐答案

IMsRdpClient.RemoteProgram.RemoteProgramMode 仅在从 MsRdpClientNotSafeForScripting 类ID有效。请参见这个MSDN页为相应的CLSID,或使用 AxMsRdpClientNotSafeForScripting 互操作类。

IMsRdpClient.RemoteProgram.RemoteProgramMode is only valid on clients initialized from the MsRdpClientNotSafeForScripting class ids. See this MSDN page for the appropriate CLSIDs, or use the AxMsRdpClientNotSafeForScripting interop class.

var rc = new AxMsRdpClient7NotSafeForScripting();
rc.Dock = DockStyle.Fill;
this.Controls.Add(rc);
rc.RemoteProgram.RemoteProgramMode = true;
// ServerStartProgram can only be called on an open session; wait for connected until calling
rc.OnConnected += (_1, _2) => { rc.RemoteProgram.ServerStartProgram(@"%SYSTEMROOT%\notepad.exe", "", "%SYSTEMROOT%", true, "", false); };
rc.Server = "server.name";
rc.UserName = "domain\\user";
// needed to allow password
rc.AdvancedSettings7.PublicMode = false;
rc.AdvancedSettings7.ClearTextPassword = "password";
// needed to allow dimensions other than the size of the control
rc.DesktopWidth = SystemInformation.VirtualScreen.Width;
rc.DesktopHeight = SystemInformation.VirtualScreen.Height;
rc.AdvancedSettings7.SmartSizing = true;

rc.Connect();

这篇关于在WinForm的托管RemoteApp会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆