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. Visual Basic
  4. application dies

application dies

Scheduled Pinned Locked Moved Visual Basic
questioncsharphelpannouncement
5 Posts 2 Posters 0 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.
  • J Offline
    J Offline
    JimWDurbin
    wrote on last edited by
    #1

    I have an vb.net 2003 application that is converting very large files that dies when the application loses focus. The application is updating several textboxes on screen that show the file names and record counts so I can see the progress. If I switch to another application while this is running, it dies. I am wondering if the fact that the application is attempting to update a screen that does not have focus is causing the problem. How do I get the code to continue execution and show me the current progress when focus is returned?

    D 1 Reply Last reply
    0
    • J JimWDurbin

      I have an vb.net 2003 application that is converting very large files that dies when the application loses focus. The application is updating several textboxes on screen that show the file names and record counts so I can see the progress. If I switch to another application while this is running, it dies. I am wondering if the fact that the application is attempting to update a screen that does not have focus is causing the problem. How do I get the code to continue execution and show me the current progress when focus is returned?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Umm...you don't. Losing the focus has absolutely no bearing on updating a text boxes or your applications windows in the way your describing. What exactly does 'dies' mean? Does your app crash with a message box or does the entire thing just freeze? Your app sounds like it's pretty much automated. If your in a loop for an extended period of time, do you give up control occasionaly with DoEvents() so Windows can handle other events in your app? RageInTheMachine9532

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Umm...you don't. Losing the focus has absolutely no bearing on updating a text boxes or your applications windows in the way your describing. What exactly does 'dies' mean? Does your app crash with a message box or does the entire thing just freeze? Your app sounds like it's pretty much automated. If your in a loop for an extended period of time, do you give up control occasionaly with DoEvents() so Windows can handle other events in your app? RageInTheMachine9532

        J Offline
        J Offline
        JimWDurbin
        wrote on last edited by
        #3

        Thanks for the reply. When the application loses focus (e.g. I go to MS word or whatever) and then return to the application, the window is completely blank and an hourglass is displayed when the mouse is on any part of the window with the exception of the close button. I have broken the app into pieces and I am sure that the piece that is running should complete in a few minutes, but it never does. Jim

        D 1 Reply Last reply
        0
        • J JimWDurbin

          Thanks for the reply. When the application loses focus (e.g. I go to MS word or whatever) and then return to the application, the window is completely blank and an hourglass is displayed when the mouse is on any part of the window with the exception of the close button. I have broken the app into pieces and I am sure that the piece that is running should complete in a few minutes, but it never does. Jim

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OK. If your app never repaints (you get a white window for instance), you have to place Application.DoEvents() in you automation loop so your app can actually process the WM_PAINT messages that are being sent to your app and repaint the screen:

          Dim Index as Integer
          For Index = 0 to 10000
          '.
          '... Do some processing here...
          '.
          ' Let our app respond to other messages here, like repaint our forms...
          Application.DoEvents()
          Next

          RageInTheMachine9532

          J 1 Reply Last reply
          0
          • D Dave Kreskowiak

            OK. If your app never repaints (you get a white window for instance), you have to place Application.DoEvents() in you automation loop so your app can actually process the WM_PAINT messages that are being sent to your app and repaint the screen:

            Dim Index as Integer
            For Index = 0 to 10000
            '.
            '... Do some processing here...
            '.
            ' Let our app respond to other messages here, like repaint our forms...
            Application.DoEvents()
            Next

            RageInTheMachine9532

            J Offline
            J Offline
            JimWDurbin
            wrote on last edited by
            #5

            Thanks again. I will give that a try. Jim

            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