一次执行多个任务? (结合GUI相关功能来执行一些处理)
如果标题听起来“关闭”,我很抱歉,但进一步详细说明,这是我的问题 - 基本上我编写了一个简单的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.