Doing multiple tasks at once? (combining a GUI related function to carryout some process)
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 (开发者_如何学Pythontext 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.
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.
精彩评论