在C#中运行并显示富文本文件中的exe文件

发布于 2024-09-09 01:20:59 字数 71 浏览 1 评论 0 原文

如何在 C# 中以富文本文件形式运行并显示 exe 文件(例如 Telnet)?我想要富文本文件显示 exe 文件所显示的内容。

How can I run and show an exe file (e.g. Telnet) in rich text file in C#? I wanted the rich text file to show what the exe file is showing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰火雁神 2024-09-16 01:20:59

特别是对于 telnet,您有两种可能性:

  1. 事实上,telnet 无非是通过 tcp 会话发送文本,您可以建立自己的 tcp 连接并使用它,或者采取一些 帮助类
  2. telnet.exe(命令行版本)使用标准输入和输出来发送和接收数据。因此,您可以通过 进程类 启动该进程并使用 startInfo 将它们重定向到您的某个位置自己的应用程序。在这里,您可以获取此流,将其转换为字符串,并将其以您喜欢的任何格式放入 RichTextBox。

Especially regarding to telnet you have two possibilities:

  1. Due to the fact, that telnet is nothing more than sending text over a tcp session you can make your own tcp connection and use it or take some helper class.
  2. The telnet.exe (command line version) uses the standard input and outputs to send and receive data. So you can start the process by the Process class and use a startInfo to redirect them somewhere into your own app. Here you can take this stream, convert it into a string and put it with any formatting you like into a RichTextBox.
思念满溢 2024-09-16 01:20:59

You will have to start the exe using System.Diagnostics.Process, and then redirect stdout to your rich text file.

See this article on CodeProject for a good example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文