cancel
Showing results for 
Search instead for 
Did you mean: 

"Could not identify process owning the current foreground window" error while working with IBM Personal Communications

MartinMayrhofer
Level 4
We have a process which has to main parts. In the first part the proess is working in a web application using Google Chrome. After the first part is finished Chrome is closed and IBM Personal Communications is started. 
Next we want to check if CICS login is shown. For this step we copy the content of the screen with menu shortcuts (ALT + b) into the clipboard.

Sending the ALT + b keystrokes fails with this error "Navigate Stage 'Send Keys' on page 'Send Key Events' - Could not identify process owning the current foreground window".

All objects are set to foreground.

What causes this error and how can we prevent this error?​
6 REPLIES 6

DaveMorris
Level 14
First thing to note here is that this error has nothing to do with the Run Mode of the objects. I know it sounds like it might, but that's just a completely different thing. Run Mode only affects whether the sessions can start alongside other sessions on the same runtime resource.

I've seen the error "Could not identify process owning the current foreground window" happen in a number of scenarios. I have found it can happen as an error that occurs while a page/screen in an app hasn't finished loading yet or like if the window is loading but you can't interact with it yet, but that's kind of a rare situation and a retry loop solves this issue. So, first make sure you have a retry loop around that action that contains the send keys. The most common scenario where I've seen this is when the screen locks, and in that situation the process can technically run and do some things, but it cannot do anything to interact with the screen because it's locked.

Beyond those scenarios, there are other situations, and I believe this Support article will walk you through things to check and possible solutions: http://portal.blueprism.com/customer-support/support-center#/path/1137420332
Dave Morris 3Ci at Southern Company Atlanta, GA

MartinMayrhofer
Level 4
Okay, your answer helped me to simulate the error in development enviroment. I found that the Login Agent VBO has an action to "unlock screen" but this doesn't work. Is there any (simple) possibility to prevent windows from screen locking?

PvD_SE
Level 12
Hi Martin,

Unsure what causes the lock. But if the screen has managed to lock itself, which would be visible by a red X in the left lower corner of the screen, you might want to try and sending "[reset]" in a Navigation stage using 'Send global keys'. This presses the left control key (which was the Error Reset key once upon a time) and the red X should go away and unlock the screen.

Reading from the IBM app goes simplest by dynamically read the screen using the coordinates (Start X, Start Y, End X and End Y) for something you expect to be on the screen, like a screen title or a lead text to a field.

Happy coding!
---------------
Paul
Sweden
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

MartinMayrhofer
Level 4
The problem was that the screen was locked. We now have solved this problem by calling the "SetThreadExecutionState" function constantly. So we can prevent that the screen will be locked.

sabarirajanm
Level 3
@MartinMayrhofer - how to use the "SetThreadExecutionState"​ in Blueprism?

MartinMayrhofer
Level 4
@sabarirajanm we solved this problem by using an action which uses a code stage to call a function defined in a global code segment.

This segment uses this code snippet:

public static class LockscreenManager {

private enum EXECUTION_STATE: uint {
ES_SYSTEM_REQUIRED = 0x00000001,
ES_DISPLAY_REQUIRED = 0x00000002,
ES_CONTINUOUS = 0x80000000
}

[DllImport("kernel32.dll")]
static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE flags);

public static void PreventLockscreen() {
SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS);
}
}

Don't forget to ​load "System.Runtime.InteropServices.dll" and import the namespace "System.Runtime.InteropServices" in Code Options.

To prevent the lockscreen you have to call the action constantly in long running loops.