PDA

View Full Version : finish transmission at screen lock windows 10



TonyInSoMD
17th October 2018, 14:27
I found how to capture the event when the computer goes into screen lock. At that time I need to send a signal to the server. The program suspends before the data can be sent. It's a small message, probably about 10 bytes. Using qDebug, I can see that line of code is being executed at screen lock, but the data isn't making it. How can I keep it running long enough to finish the transmission?

ChrisW67
20th October 2018, 03:50
I found how to capture the event when the computer goes into screen lock. At that time I need to send a signal to the server. The program suspends before the data can be sent. It's a small message, probably about 10 bytes. Using qDebug, I can see that line of code is being executed at screen lock, but the data isn't making it. How can I keep it running long enough to finish the transmission?
A screensaver activating should not stop your program from running, so I assume you mean the machine is going to some lower power state (Windows, WM_POWERBROADCAST PBT_APMSUSPEND event?). The bytes queued for transmission will not be sent until the Qt message loop is reached, at which time the program may also respond to the suspend request. At a guess, you could try explicitly calling CoreApplication::processEvents() after queuing the bytes to send but before returning control to the main loop.