Remote Desktop Client (mstsc.exe) causes loss of focus

I recently created an account with Backblaze, downloaded their software, and began backing up my Windows system. Shortly after that, I began to see a hiccup or a refresh like behavior as if I was pressing the F5 button every few seconds to a minute.

For example, if I opened Directory Opus, selected a file and pressed F2 to rename that file, and then removed my hands from my keyboard and mouse and watch the screen, after a few seconds the rename would end/cancel as if I selected another open window. The focus seems to move to the desktop, deselecting the window. Another example would be if you click a menu like Tools, the Tools menu opens and you normally see the list of menu options, but after a few seconds of not touching the keyboard or mouse, the menu goes away as if I clicked the mouse on some other part of the screen or another window.

This becomes very frustrating. I would be typing an email or in Notepad++ and suddenly I would not be typing in the window I selected because the window would lose focus. So I go into debug mode and disable Backblaze because that was the most recent software I installed, but the problem doesn't go away. So I begin going through the system tray and turning off background software one by one and testing to see if my windows lose focus. The problem doesn't stop until I kill Opus. After turning off Directory Opus, the window behavior returns to normal. My menus stay on the menu until I actually click off the menu. I can go into rename (in Windows Explorer) and it stays in rename mode until I click off the rename, etc. I also started Opus again and the bad behavior immediately starts again. Once I stop Opus from running, the window behavior returns to normal. I restared my computer several times and Opus seems to be causing this hiccup where windows will lose focus.

Now I am here in the forums looking for a little help to see if anyone else is seeing this issue and perhaps figure out why this is happening. I have a pretty strong machine so I typically have a lot of windows open and processes running and maybe I've hit some compatibility issue between 2 programs. I also leave my computer running sometimes for weeks at a time between power cycles.

The system is running Windows 11 Pro with all the recent updates. This seems like a software issue, but the basic hardware setup is an AMD Threadripper with 64GB RAM. I rarely ever see over 24 GB RAM being allocated even with 30+ windows open. Opus is the centerpiece for all my file management. Having to drop back to Windows Explorer feels basic and akward. Any help is appreciated.

Sounds very odd indeed. The only Opus-related things I can think of are a script/event gone wild and
the Explorer integration gotten somehow corrupted. I'd start with these two areas and in a second step check the entire config with a fresh and untouched Opus installation.

Thanks. I will uninstall opus, reboot, and reinstall. I have about a dozen or so modifications to the interface, most of which I got right here in the forums, but nothing very elaborate. The majority of the tweaks are fairly minor and I don't have large scripts set up. I'll post my results.

So I uninstalled Opus, rebooted, reinstalled Opus v12.30, and left it running at default settings. The installation looks generic. I did add my version 12 license to the software. Unfortunately, the bad windows behavior returned. Open menus are dismissed without touching the keyboard or mouse and renames are canceled. You can see the Opus window lose focus by the title bar shifting colors. So I had it running while I logged into the forums and I had to type my password like 3 times because the browser was losing focus mid-password. I don't think there are any scripts running. I am playing with the resource monitor to see if see any other apps that may be spiking the CPU or memory that could be a contributing factor. I don't know what I'm looking for though.

This isn't going to be caused by Opus directly. What other software do you have installed? I'd be looking at things that modify the desktop, mouse or monitor behaviour in some way (e.g. I found several threads with these symptoms that were caused by DisplayFusion).

@Jon
Thanks. I do have DisplayFusion installed and running. There are functions that create an icon overlay on the title bar that are useful for shifting around windows. I did make some changes recently to those functions. Before you posted your comments, I did disable all the DisplayFusion functions and found that the issue still existed. I believe there is a way to exclude DisplayFusion from modifying the Opus window. I'll find it and post my results.

One reason that pops up in a number of the DisplayFusion threads is the multi-monitor taskbar feature, if you haven't yet tried turning that off.

@Jon

I apologize for being missing for almost 2-weeks. I was out sick and on vacation.

Just a word on the DisplayFusion multi-monitor support. I've been running DisplayFusion with my three 4K screens on Windows 10/11 with a full icon overlay for about 6 years and have never had any issues like this. But, in the effort of troubleshooting, I added dopus to the DisplayFusion compatibility list which means that DisplayFusion does not modify the dopus window. It's ignored. The issue still occurs so I took the next step and disabled and removed DisplayFusion so it would not start or run and rebooted. The issue still occurs. I also run a program called Fences from Stardock and this modifies Windows behaviors as well. Did the same thing with Fences and disabled it. The dopus continues to lose focus.

Based on this testing, I began to disable apps running in the systems tray, one at a time, and tested for 30 seconds between each and found that the problem continued after disabling all system tray programs including the anti-virus software. When I say disable, I mean the application is verified as not running in the process tree.

After the system tray has no running apps, I began to kill programs in the Processes section of the Windows Task Manager starting with the browsers, motherboard application (sound software), system tweaking software, CloudSysc software, RGB, keyboard/mouse software, etc., then even deeper to the point that I was afraid the system would be unstable if I killed any more apps. This took me about 2 hours to get to this point. I stopped and restarted dopus dozens of times and the problem persisted to this point.

I don't know what this exactly means, but this only seems to only affect dopus. Other applications do not do this after dopus is closed. It only looks like other apps are affected as dopus loses focus, then the focus changes to another app. Closing dopus ends this behavior.

In conclusion, I have dopus running on my laptop with Displayfusion and icon overlays using the same software setup and everything works fine. These are the same versions of the software. At this point, I think I'm due a reinstall of Windows. When nothing makes sense like this, it could be anything. Any final suggestions before I blow this away and reinstall?

There are some tools which can help work out which program is getting the focus, which might provide a clue as to why it's happening.

This one looks nice and simple, and also has source-code which is reassuring:

(Found via How to detect a background program (in Windows 7) which steals active focus automatically? - Super User which has some alternative suggestions as well.)

Many thanks for the tip. I will play around with this and see what I can figure out and report back.

I appreciate it. I love tools like this.

I downloaded the focus.exe program and ran it. The program steeling focus is C:\Windows\System32\mstsc.exe. This is the Windows Remote Desktop Connection app. I do not know why this is asserting itself every 30 to 60 seconds, or why this only seems to affect dopus. Does any part of dopus use RDP?

My router blocks the RDP port 3389 for inbound and I never use RDP outside my LAN unless I'm on an active VPN to my workstation at the office. I scanned it for viruses and nothing was found. I scanned all of the System32 directories and it's clean. I'll start a full system scan tonight and see if anything comes up.

Oddly after poking at RDP for a while now, it's started to behave and hasn't asserted in a while now. Anyways, I'm on the right path at least. Thanks a ton for the help. I'll observe for a few days and see if I can determine anything definitive.

Seems there are quite a few threads about it on the web:

This one suggests it may be tied to how WSLg uses RDP:

And suggests this as the fix:

Thank you, Leo. I do run WSL v2.0 as well so this could very well be the culprit. The virus scan was clean so your suggestions are likely the best path. I really appreciate you taking the time to do some research on this for me. Very helpful.

I will review each of those threads and see if this fixes the issue. Thanks again.

1 Like

So it's been about 2-weeks of using my PC after applying the fix posted above and quoted below and so far, there has been no further problems with RDP. I think this is a very annoying bug in the Microsoft code that they need to fix.

Specifically, I created a file named .wslconfig in the root folder of your Windows profile, like c:\users\loginname. In this text file add these 2-lines.

[wsl2] gui
Applications=false

Save the file and reboot. The focus theft stops.

Many thanks to the Dopus team for the help and research.

3 Likes