application dies
-
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?
-
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?
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
-
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
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
-
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
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()
NextRageInTheMachine9532
-
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()
NextRageInTheMachine9532
Thanks again. I will give that a try. Jim