Frozen screen after activation of Win screensaver
-
Hi, my program contains a rather time consuming loop to send newsletter emails (in no separate thread). Within this loop, the screen shall be updated after every loop circle, i.e. after every message being sent (simply updating the number of the sent messages and setting a hook in the addressees grid). So far no problem. Now, after some minutes running the procedure alone, the standard win logo screensaver absorbs the screen. And if I'm now returning to my program window by hitting any key, the screen gets frozen, although the program behind keeps running well. The screen will not be updated until the whole loop has been worked off. This happens although there is a .refresh command in every loop circle. Does anybody have a piece of advice how to fix this? Cheers, Wolfgang, Berlin/Germany
-
Hi, my program contains a rather time consuming loop to send newsletter emails (in no separate thread). Within this loop, the screen shall be updated after every loop circle, i.e. after every message being sent (simply updating the number of the sent messages and setting a hook in the addressees grid). So far no problem. Now, after some minutes running the procedure alone, the standard win logo screensaver absorbs the screen. And if I'm now returning to my program window by hitting any key, the screen gets frozen, although the program behind keeps running well. The screen will not be updated until the whole loop has been worked off. This happens although there is a .refresh command in every loop circle. Does anybody have a piece of advice how to fix this? Cheers, Wolfgang, Berlin/Germany
What language is your code? Using .NET? Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
What language is your code? Using .NET? Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Hmmm... I'm not a VB coder but... You mentioned you call .refresh every iteration of the loop. Are you referring to the Control.Refresh() method? If so, are you calling it on just one control or on the window itself? This type of problem is common when you are consuming all of the UI threads time and not allowing windows messages to get dispatched. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Hmmm... I'm not a VB coder but... You mentioned you call .refresh every iteration of the loop. Are you referring to the Control.Refresh() method? If so, are you calling it on just one control or on the window itself? This type of problem is common when you are consuming all of the UI threads time and not allowing windows messages to get dispatched. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Well, actually I'm calling both, the Me.refresh (which presumably corresponds to the this.refresh in C#) at the beginning, and the control.refresh method at the end of each loop circle, but this doesn't help. It seems that at runtime the screen upadate is being postponed behind the other programmatical tasks of the loop as a kind of secondary task. If so, what would you recommend to give the screen update back its demanded priority? Wolfgang
-
Hmmm... I'm not a VB coder but... You mentioned you call .refresh every iteration of the loop. Are you referring to the Control.Refresh() method? If so, are you calling it on just one control or on the window itself? This type of problem is common when you are consuming all of the UI threads time and not allowing windows messages to get dispatched. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Well, actually I'm calling both, the Me.refresh (which presumably corresponds to the this.refresh in C#) at the beginning, and the control.refresh method at the end of each loop circle, but this doesn't help. It seems that at runtime the screen upadate is being postponed behind the other programmatical tasks of the loop as a kind of secondary task. If so, what would you recommend to give the screen update back its demanded priority? Wolfgang
When the screensaver is removed, all windows will be invalidated and eventually will redraw themselves. If you are in a loop then the WM_PAINT message sent to the app as a result of this invalidation will not get processed until the loop ends. That, said, I would expect Refresh() to immediately redraw the window. Maybe I'm wrong about that. What you're describing sounds like the delayed WM_PAINT handling described above. Maybe try this every iteration of your loop (I'm assuming Me is a form, not just a control on a form - I'm not a VB coder so I don't know what "Me" generally is :)): Me.Invalidate(); Me.Update(); instead of Refresh(); Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
When the screensaver is removed, all windows will be invalidated and eventually will redraw themselves. If you are in a loop then the WM_PAINT message sent to the app as a result of this invalidation will not get processed until the loop ends. That, said, I would expect Refresh() to immediately redraw the window. Maybe I'm wrong about that. What you're describing sounds like the delayed WM_PAINT handling described above. Maybe try this every iteration of your loop (I'm assuming Me is a form, not just a control on a form - I'm not a VB coder so I don't know what "Me" generally is :)): Me.Invalidate(); Me.Update(); instead of Refresh(); Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Hi Mark, meanwhile I tried your suggestion. Result: negative. With the .invalidate() and the .update() command the form doesn't redraw itself at all, not even before the screensaver has been invoked. And the documentation of the .refresh() method in principle promises exactly, what I'm looking for: "... Forces the control to invalidate its client area and immediately redraw itself and any child controls. (Inherited from Control.)" But it doesn't do so, unfortunately. Do you have any further idea, how I get my app paying attention to the WM_PAINT handling, after the screensaver has been removed (if this is the real problem)? Greetings from Berlin, Germany Wolfgang
-
Hi Mark, meanwhile I tried your suggestion. Result: negative. With the .invalidate() and the .update() command the form doesn't redraw itself at all, not even before the screensaver has been invoked. And the documentation of the .refresh() method in principle promises exactly, what I'm looking for: "... Forces the control to invalidate its client area and immediately redraw itself and any child controls. (Inherited from Control.)" But it doesn't do so, unfortunately. Do you have any further idea, how I get my app paying attention to the WM_PAINT handling, after the screensaver has been removed (if this is the real problem)? Greetings from Berlin, Germany Wolfgang
What happens if you drag another window across your app's form when it's in the loop? Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
What happens if you drag another window across your app's form when it's in the loop? Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Hi Mark, unfortunately, I've to leave immediately for a business trip until June, 22nd (I'm somewhat in a hurry to get the plane...). I'm going to try later what happens when dragging another window across the loop's form. So far thanks for your efforts, I get in touch with you as soon as I'm back. All the best Wolfgang