Focus not on TC after closing internal viewer due to bug in Windows

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

Due to my way of working on my Windows 11 system, I often encountered this issue:
If I view a file in TC and then close it, or press F1 and then close the help, or start an external program and close it, the focus is not returned to the TC window and I have to press Alt+Tab or click the TC window. This is very annoying, but I found out when this happens. I share this so it may help others encountering the same thing.

The issue is not specifically related to TC, but also happens with other programs, for example with Windows Explorer.

Steps to reproduce:
  • Press the Windows key on the keyboard to open the Start menu.
  • Right-click a pinned app on the task bar and choose one of the options to open the app.
    The app is opened. The right-click menu and the Start menu that were open are closed, but apparently not properly which causes the issue.
  • Now open TC without using the Start menu, for example by using a shortcut on the Desktop or using a pinned icon on the taskbar.
  • Select a file or folder and press F3 to view, and then close with Esc.
    The focus is not returned to TC, but the Explorer process has focus. If I press Alt+F4, the Windows Shutdown window opens.
The focus is also put on Explorer when you search something using search in TC's internal viewer and the search string cannot be found.

To return to Windows behaving normally do this:
  • Press the Window key twice to open and then close the Start menu properly.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *ghisler(Author) »

As you write, it's a Windows bug, so I can't do anything to fix it. Your trick with the Windows key doesn't seem to work here.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

ghisler(Author) wrote: 2024-09-17, 16:32 UTC Your trick with the Windows key doesn't seem to work here.
You mean pressing the Windows key twice to have Windows behave normally again?
If so, try restarting the Explorer process in task manager.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *ghisler(Author) »

Even after restarting the Explorer, opening a text file with Enter or F4 and closing the new app style editor would often not return focus to Total Commander. But it also doesn't go to Explorer, Alt+F4 does nothing.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

ghisler(Author) wrote: 2024-09-18, 08:47 UTC Even after restarting the Explorer, opening a text file with Enter or F4 and closing the new app style editor would often not return focus to Total Commander. But it also doesn't go to Explorer, Alt+F4 does nothing.
Confirmed. Probably this is a similar but different issue. Instead of Notepad, try running calc.exe by typing it in the address bar of Explorer, or on TC's command line. Can you then confirm the issue and fix? Or when using TC's internal viewer?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *ghisler(Author) »

No, when I run calc.exe from the TC command line and then close it, the focus always returns to TC, even after following your procedure of opening something from the context menu in the start menu. Windows 11 pro 23H2.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

ghisler(Author) wrote: 2024-09-20, 10:07 UTC No, when I run calc.exe from the TC command line and then close it, the focus always returns to TC, even after following your procedure of opening something from the context menu in the start menu. Windows 11 pro 23H2.
Who said anything about a context menu in the Start menu? I described the procedure of pressing the Windows key and then ignoring the Start menu and right-clicking a pinned app on the task bar.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *ghisler(Author) »

Sorry, I misunderstood it as an app pinned in the start menu. Why else would you open the start menu when you then don't use it? Anyway, I tried that too, but the focus still returns to TC.
Author of Total Commander
https://www.ghisler.com
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *Fla$her »

If Open-Shell-Menu is used instead of the system Start menu, then such problems are quite possible.
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

ghisler(Author) wrote: 2024-09-23, 12:36 UTC Sorry, I misunderstood it as an app pinned in the start menu. Why else would you open the start menu when you then don't use it? Anyway, I tried that too, but the focus still returns to TC.
I have the task bar auto hidden and sometimes use the Windows key to bring it up instead of using the mouse. The issue remains if the task bar is not hidden. I could reproduce it on latest Windows 11 23H2, Windows Sandbox Windows 22H2 and a Windows 10 virtual machine (although harder to reproduce).

For me, the easiest way to reproduce it was using 64-bit TC pinned to the task bar (32-bit TC often does not have the problem). Press the Windows key and then right-click the 64-bit TC icon on task bar and select "Total Commander 64 bit". Then select file, press F3 and then Esc. On Windows 10, I could best reproduce it just after a Window restart.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *ghisler(Author) »

Thanks, I can reproduce your last instructions. It really seems to be a bug in Windows, the focus goes "nowhere". Alt+F4 or Alt+Space bar do nothing. I tried finding out where the focus goes with the Microsoft tool Inspect32, but it reports no active window:
How found: Focus [o:0xFFFFFFFC,c:0x0]

Transient HWND event
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5748
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Focus not on TC after closing internal viewer due to bug in Windows

Post by *white »

ghisler(Author) wrote: 2024-09-27, 09:50 UTC Thanks, I can reproduce your last instructions.
Thanks for confirming.
Post Reply