1

I am working on a program for Windows, and only on Windows xp 32 bit my bug happens.

The thing is that when Windows is in sleep mode and I wake it up and my GUI is messed up.

My program is connected to a server, and when the computer is waking up, the connection is broken. My GUI is going to the Login panel and doing a re-connection, but for some reason, the GUI display is only showing the animation of the re-connection, with all the rest of the components from the last screen also displayed.

What it should be showing is a blank screen with-reconnecting animation.

I want to catch the event/message that the system is passing to my application when it is waking up to clear the screen before reconnecting.

Is there any way to do so?

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106
eladyanai
  • 1,063
  • 2
  • 15
  • 34
  • WM_POWERBROADCAST? (http://msdn.microsoft.com/en-us/library/aa373247(v=vs.85).aspx) – floyd73 Aug 11 '11 at 09:40
  • thank you for your time, but all of these messages are talking about resuming for critical-sleep or low battery, i am talking about a regular sleep of XP due to a long idle OS or something like that... – eladyanai Aug 11 '11 at 09:44
  • `WM_POWERBROADCAST` subtype `PBT_APMRESUMESUSPEND` seems correct. There's no need to redraw when unless there's a user present. – MSalters Aug 11 '11 at 09:47
  • To tell the truth I never needed to use this message but from the description in MSDN the message is sent whenever the system power mode changes (i.e not only when it goes to sleep due to low battery or some other critical situation). But then again I might well be wrong.. – floyd73 Aug 11 '11 at 09:57
  • 3
    Instead of catching the wakeup message, why not just fix your GUI bugs? Your program should be able to react consistently to whatever is thrown at it; a wakeup shouldn't be any harder to handle than a repaint. – Mark Ransom Aug 11 '11 at 15:20
  • the thing is that on my program is connected to a server, and when the computer is waking up, the connection is broken and it is going to the Login panel and doing- re-connection, but for some reason, it is only showing the animation of the re-connection, with all the rest of the components from the last screen... instead of a blank screen with- reconnecting animation. i want to catch the event to clear the screen before reconnecting. – eladyanai Aug 14 '11 at 07:59
  • Possible duplicate of [How to get WM\_POWERBROADCAST message in CWinApp?](https://stackoverflow.com/questions/14765534/how-to-get-wm-powerbroadcast-message-in-cwinapp) – Richard Chambers Jan 27 '19 at 06:24

0 Answers0