一次执行多个任务? (结合GUI相关功能来执行一些处理)

发布于 2024-10-05 07:55:02 字数 345 浏览 1 评论 0原文

如果标题听起来“关闭”,我很抱歉,但进一步详细说明,这是我的问题 - 基本上我编写了一个简单的 Winsock 服务器,它在连接的客户端之间传递信息(文本消息)(这是控制台应用程序)。现在,对于这个程序,我尝试将从 win32api 中学到的知识与结合起来客户端程序。现在我有点超前了,我继续编写 UI 的基本外观,但现在我不知道如何将两者结合起来?据我了解(:|),控制台应用程序从上到下顺序运行,而 UI 不断在屏幕上绘制窗口并等待发生某些事情。所以最后说到重点,我该如何将这些结合起来呢?我对此很反感。

I'm sorry if the title sounds "off", but to elaborate further, this is my problem - Basically I've written a simple Winsock server which passes information (text messages) between connected clients (This is the console application). Now for this program I've tried combining what I've learned from the win32api with the client program. Now getting a little ahead of my self I went ahead and wrote the basic look for the UI but now I don't know how to combine the two?. From what I understand ( :| ) the console application is running from top-bottom sequentially while a UI is continuously drawing the window on the screen and waiting for something to happen. So to finally get to the point, how do I combine these too??. I'm quite put off by this.

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

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

发布评论

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

评论(1

四叶草在未来唯美盛开 2024-10-12 07:55:02

GUI 通过事件驱动的消息循环来工作。该消息循环将传入事件分派给函数调用。因此,如果您按下按钮,就会调用一个函数,然后该函数可以调用例如网络send函数。如果您需要发送(或接收)大量数据,您应该为网络内容创建一个单独的线程和消息循环,以便 GUI 保持响应。

A GUI works through an event-driven message-loop. That message-loop dispatches incoming events to function-calls. So if you press a button, a function is called, which then can call for instance the network send-function. If you need to send (or receive) large amounts of data, you should create a separate thread and message-loop just for the network stuff, so that the GUI stays responsive.

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