My app will be humming along moving motors and recording data, when Windows decides it's not responding. Usually takes about 5-10 seconds, or may not happen at all. My screen updates stop, but all my motion and data collections continues to work fine. When the activity is supposed to stop, it stops. Program flow goes back to the callback, the screen is updated and everything is normal again. No data is lost. This is one thread and just a series of calls to various instrument drivers, then data updates to text boxes.
Announcement
Collapse
No announcement yet.
How does Windows decide a program is "not responding"?
Collapse
X
-
Windows detects an app is "not responding" when the app's message queue is full (ie. you are running the app in a loop without allowing Windows to process messages). The best way around this (IMO) is to put your processing code in a second thread and disable the dialog that's running in the primary thread. The primary thread will then be able to process the message queue properly, while the second thread does it's work. That's basically all there is to it.
-
-
Conrad,
I thought it was to do with the windows message loop. When Windows sends your application a message it expects you to take it in a reasonable time. If you don't then Windows assumes the application is not responding.
When you try to close an application, a WM_CLOSE notification will be sent to your program to tell it to close down. Again, if your program does not respond in a timely manner then Windows will offer the option to the user to forcibly terminate the application with the potential loss of data.
Are you sure you keep responding to messages in your application's message queue while your data is being acquired?
Paul.
Comment
-
-
SendMessageTimeout() would be useful.Michael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
-
-
Thanks all- though it might not be the most sophisticated way, a dialog doevents in my loop solved the problem nicely! The loop typically runs in about 100 mS, but it runs continuously for up to a minute or two.Michael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
-
-
Michael, I need to do it that way at some point, as an abort would be nice feature. Ok, an essential featureOTOH, the demo is longer than my entire app, and since my last fix and post, I've used the app to collect data on multiple parts, analyzed the data in a spreadsheet and written/distributed a report on those parts, so the quick fix was pretty successful!
Comment
-
-
> the demo is longer than my entire app...
I write with a lot of white space and comments.Michael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
-
-
Originally posted by Michael Mattias View PostI write with a lot of white space and comments.
=====================================
"Alia jacta est." (The die is cast.)
JULIUS CAESAR
after crossing the Rubicon
=====================================It's a pretty day. I hope you enjoy it.
Gösta
My Ego Site: http://www.SwedesDock.comPB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.htmlJWAM: (Quit Smoking): http://www.SwedesDock.com/smokingLDN - A Miracle Drug: http://www.SwedesDock.com/LDN/
Comment
-
-
>>I write with a lot of white space and comments.
>Among other things
Thank you for mentioning - even off-handedly - the flair, elan, and panache.
MCMMichael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
-
-
Originally posted by Michael Mattias View Post>
Thank you for mentioning - even off-handedly - the flair, elan, and panache.
MCMIt's a pretty day. I hope you enjoy it.
Gösta
My Ego Site: http://www.SwedesDock.comPB Newby Tips: http://www.swedesdock.com/powerbasic/pb_shortcuts.htmlJWAM: (Quit Smoking): http://www.SwedesDock.com/smokingLDN - A Miracle Drug: http://www.SwedesDock.com/LDN/
Comment
-
Comment