如何在 WPF 应用程序中托管终端会话 (mstsc)?
有一些工具可用于管理多个终端 (mstsc) 会话。
我将如何在 WPF 中实现类似的目标?
There are some tools out there for managing multiple terminal (mstsc) sessions.
How would I go about achieving something similar in WPF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用
WindowsFormsHost
元素来托管 RDP 的 ActiveX 控件。有一个简短的示例如何将 Windows Media Player 集成到 WPF 应用程序中。 RDP 控件的托管类似。
You should use
WindowsFormsHost
element to host the ActiveX control of RDP.There is short sample how to integrate Windows Media Player into WPF application. The hosting of the RDP control is similar.
AxInterop.MSTSCLib.dll,
Interop.MSTSCLib.dll
您可以从 MS 官方网站的 MS RDCMan 获取它。如何从“参考”中的 COM 选项卡添加它 - 是个好问题......
2. 添加到 XAML WindowsFormsHost:
创建新的 rdp 客户端类:
公共类 RdpControl :AxMSTSCLib.AxMsRdpClient9NotSafeForScripting
{
公共 RdpControl()
: 根据()
{
}
私有无效InitData()
{
_rdp = 新的 RdpControl();
((System.ComponentModel.ISupportInitialize)(_rdp)).BeginInit();
_rdp.Name = "rdp";
_rdp.Enabled = true;
wfHost.Child = _rdp;
((System.ComponentModel.ISupportInitialize)(_rdp)).EndInit();
}
使用此处理程序添加到 UserControl 按钮:
希望有帮助。
AxInterop.MSTSCLib.dll,
Interop.MSTSCLib.dll
You can get it from MS RDCMan from official MS site. How to add it from COM tab in "References" - is great question...
2. Add to XAML WindowsFormsHost:
Create new rdp client class:
public class RdpControl : AxMSTSCLib.AxMsRdpClient9NotSafeForScripting
{
public RdpControl()
: base()
{
}
In behind code of your UserControl:
private void InitData()
{
_rdp = new RdpControl();
((System.ComponentModel.ISupportInitialize)(_rdp)).BeginInit();
_rdp.Name = "rdp";
_rdp.Enabled = true;
wfHost.Child = _rdp;
((System.ComponentModel.ISupportInitialize)(_rdp)).EndInit();
}
Add to UserControl button with this handler:
Hope it helps.
这些工具很可能使用远程桌面 ActiveX 控件,该控件设计为托管在网页中,但由于它是 ActiveX 控件,因此您也应该能够自行托管它。
如果不出意外,您可以在 WPF 应用程序中嵌入一个 Web 浏览器控件,然后在其中嵌入 ActiveX 控件。
请参阅以下链接:
Those tools are most likely using the Remote Desktop ActiveX Control which is designed to be hosted in web pages, but since it is an ActiveX control, you should be able to host it on its own as well.
If nothing else, you could embed a web browser control in your WPF application and then embed the ActiveX control inside that.
See the following links: