Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Frozen screen after activation of Win screensaver

Frozen screen after activation of Win screensaver

Scheduled Pinned Locked Moved Graphics
helpcsstutorialquestion
10 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sohst
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • S sohst

      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

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      What language is your code? Using .NET? Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      S 1 Reply Last reply
      0
      • M Mark Salsbery

        What language is your code? Using .NET? Mark

        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

        S Offline
        S Offline
        sohst
        wrote on last edited by
        #3

        Hi Mark, I'm using VB.NET. Wolfgang

        M 1 Reply Last reply
        0
        • S sohst

          Hi Mark, I'm using VB.NET. Wolfgang

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          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

          S 2 Replies Last reply
          0
          • M Mark Salsbery

            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

            S Offline
            S Offline
            sohst
            wrote on last edited by
            #5

            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

            M 1 Reply Last reply
            0
            • M Mark Salsbery

              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

              S Offline
              S Offline
              sohst
              wrote on last edited by
              #6

              ... not to forget, Mark, that the problem doesn't occur as long as the screensaver isn't interfering. This, i.e. the win screensaver, seems to change the preferences in the GUI of my program. Wolfgang

              1 Reply Last reply
              0
              • S sohst

                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

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                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

                S 1 Reply Last reply
                0
                • M Mark Salsbery

                  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

                  S Offline
                  S Offline
                  sohst
                  wrote on last edited by
                  #8

                  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

                  M 1 Reply Last reply
                  0
                  • S sohst

                    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

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #9

                    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

                    S 1 Reply Last reply
                    0
                    • M Mark Salsbery

                      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

                      S Offline
                      S Offline
                      sohst
                      wrote on last edited by
                      #10

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups