Determine if an application is blocked / busy?

I am trying to automate the GUI of an external application using C # /. NET 4.0

An application that is automatic (AUT) is a VB6 application.

When performing an action or pressing the AUT button, sometimes it spends a lot of time waiting for a DB response. When an application expects database results, the application itself does not work (does not register a lot of CPU usage), but it is locked (you cannot click or interact with it).

- Yes, I tried to look at the mouse pointer (hourglass) as an indicator, but sometimes the application is blocked, but the cursor is normal. So this is unreliable.

- I tried to look at the main AUT process for TotalProcessorTime (this measures if the application is IDLE or BUSY), but, as I said, sometimes the application is IDLE and is still blocked.

So, I would like to write the feed to the stackOverflow collection to see if anyone knows how to handle it and / or if you have ideas on how to achieve this.

thanks

EDIT:

I played, and just discovered something.

While AUT is locked, it does not respond to keyboard or mouse input. However, if I send WM_LBUTTONCLICK messages to the window, I can confirm that the messages are being processed (and the user interface is changing).

So, I assume that they purposefully block the application when calling the database.

+7
source share
1 answer

You can check if the user interface of this application is responsive:

Get a process instance for this application and check its Responding property. as:

 //To get the process instance Process application = null; foreach (var process in Process.GetProcesses()) { if (process.ProcessName == "The Process Name") { application = process; break; } } //to check if the process UI is not responding if (application.Responding) { // } 

Edit: You can change the timeout used by application.Responding check this one .

+3
source

All Articles