Apps start as ADMIN don't get focus and foreground

Found a bug in "Everything"? report it here
Post Reply
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

Hi,

I love this tool, very fast and efficient. I made it my default launcher for the apps links in %APPDATA%\Microsoft\Windows\Start Menu\Programs too. It works great except for the app that are set to start as ADMIN: then UAC popup only flash and blink in Windows taskbar instead of being brought to the foreground. Hence user will have to use mouse or ALT+TAB to set focus on it and bring it on the top.

This will happen if Windows UAC setting is set as default (use the secure desktop). If UAC is set to not use secure desktop, the popup will be on top but keyboard won't be used to select button, mouse only (windows feature that can be changed).

If the same app is launch via the Windows startup menu search WIN+S, everything work as intended. Same if it is launched from Windows File Explorer or DOpus file Explorer or from CMD.EXE with just "%APPDATA%\Microsoft\Windows\Windows\Start Menu\Path to Some App.lnk"

I don't know it will be possible but it would be a great feature if it could work the same in Everything. Now, it is a little frustrating to have to remember to use start menu to launch admin apps.

Regards

Setup: Alway last Everything version, Windows 10 x64 (french)
void
Developer
Posts: 15038
Joined: Fri Oct 16, 2009 11:31 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by void »

Thanks for bringing this bug to my attention.

When opening a file in Everything, Everything would try the "open" verb first (since Everything 817b) and if that failed, it would fall back to the null verb (default verb).
Before Everything 817b, Everything would use the null verb.

I've reverted back to using the null verb to open files with Everything 854b.

Should be fixed in Everything 854b or later.
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

I installed the 1.4.1.854b (x64) and unfortunately, nothing changed. Would be there a setting to enable/disable?
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

The only workaround for now is to start Everything as admin, then every app launched as admin won't need to prompt UAC popup and start as any other standard apps.
Coldblackice
Posts: 71
Joined: Sun Jul 13, 2014 12:20 am

Re: Apps start as ADMIN don't get focus and foreground

Post by Coldblackice »

fred_gaou wrote:Hi,

I love this tool, very fast and efficient. I made it my default launcher for the apps links in %APPDATA%\Microsoft\Windows\Start Menu\Programs too. It works great except for the app that are set to start as ADMIN: then UAC popup only flash and blink in Windows taskbar instead of being brought to the foreground. Hence user will have to use mouse or ALT+TAB to set focus on it and bring it on the top.

This will happen if Windows UAC setting is set as default (use the secure desktop). If UAC is set to not use secure desktop, the popup will be on top but keyboard won't be used to select button, mouse only (windows feature that can be changed).

If the same app is launch via the Windows startup menu search WIN+S, everything work as intended. Same if it is launched from Windows File Explorer or DOpus file Explorer or from CMD.EXE with just "%APPDATA%\Microsoft\Windows\Windows\Start Menu\Path to Some App.lnk"

I don't know it will be possible but it would be a great feature if it could work the same in Everything. Now, it is a little frustrating to have to remember to use start menu to launch admin apps.

Regards

Setup: Alway last Everything version, Windows 10 x64 (french)
Fred (or anyone), could you explain what you mean by using Everything as your default app launcher for app links in %AppData%? Does this mean just opening a new instance of Everything and searching for an "App*.lnk"? I'm curious how this works, particularly if it's more than merely searching for a program shortcut.
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

Coldblackice wrote:Fred (or anyone), could you explain what you mean by using Everything as your default app launcher for app links in %AppData%? Does this mean just opening a new instance of Everything and searching for an "App*.lnk"? I'm curious how this works, particularly if it's more than merely searching for a program shortcut.
This is the achieved RESULTS of what I mean

When I press Win+N or click on the Everything tray icon, the Everything window start with an Apps filter as default that list only program shortcuts. This way it's quick to start my programs.

But if I need to search for any other things than programs, I just press Ctrl+A to remove the filter and see everything.

Here is my personal settings for that.


Set the needed filters

Create a filter named Apps

Set search pattern as : "exact:type:Shortcut "%APPDATA%\Microsoft\Windows\Start Menu\Programs"|"%SystemDrive%\ProgramData\Microsoft\Windows\Start Menu\Programs"
Macro : ap

Note
  • Replace Shortcut with the valid locale value (it's Raccourci for french).
  • Replace %APPDATA% with C:\Users\{username}\AppData\Roaming
  • Replace %SystemDrive% with the drive letter where Windows is installed (should be C:)
You can use the Advanced search to help yourself to create your own search/filter pattern that will point to the programs shortcuts folders.
------------------
Edit or create the filter named Everything
Set the keyboard shortcut as : Ctrl+A
Leave anything else with blank value.


Set the needed options

Indexes

Note: This my personal choices for indexes settings. Adapt to your own use, the important thing you have to care is that program shortcuts folders have to be indexed.

(Only if you need to exclude everything but the shortcuts program folders) In NTFS>Windows(C:)
include only checked and set %APPDATA%\Microsoft\Windows\Start Menu\Programs;%SystemDrive%\ProgramData\Microsoft\Windows\Start Menu\Programs

(Required if the exclude checkbox set as below are checked) In Folders
Add the same folders as above.

In Exclude
Check all "Exclude box"
Put in Include only files (important is that it must contain all the file type you need to get included the *.lnk for shortcut):
*.bat;*.mkv;*.mp3;*.exe;*.avi;*.mp4;*.png;*.jpg;*.lnk;*.docx;*.pdf;*.xls;*.doc;*.gpx;*.txt;*.rtf;*.sln


General

In Home
  • Search → Custom
  • Filter → Apps
  • View → Use last value
In Keyboard
Toggle window hotkey → Win+N (or whatever you like)
void
Developer
Posts: 15038
Joined: Fri Oct 16, 2009 11:31 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by void »

I'm having trouble replicating the issue here on 854b, I've tried with and without secure desktop. Both bring the UAC prompt into the foreground.

Everything 853b or earlier doesn't show the UAC prompt for me when run as admin is enabled on a lnk shortcut.

Could you please confirm 854b is running from Everything -> Help -> About.

If it is, could you please email me the verbose debug output when launching a shortcut that has run as admin enabled.

Hope I can help..
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

I confirm using version 1.4.1.854b (x64) from the about dialog. I installed it as portable, service is running and I reboot after update. I found out an important detail: this behavior only occurs if you set the windows taskbar to auto hide. Now, you should succeed to replicate the issue. Else I will sent you the log.
In confirm that the issue only occurs with Everything because even if taskbar is auto hidden, I have no issue launching some *.lnk set to be run as admin with cmd.exe or via a simple batch such as:

Code: Select all

@echo off
"%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt [ADMIN].lnk"
pause
exit
or with WIN+R then execute "%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt [ADMIN].lnk"
or with explorer.exe or dopus.exe, etc.

Secure desktop is triggered and UAC pop up normally.

Tell me if you still can not reproduce the issue.
void
Developer
Posts: 15038
Joined: Fri Oct 16, 2009 11:31 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by void »

No luck sorry, I still get the UAC prompt in a secure desktop.

Edit:
Requirements for Administrator Applications
Use the HWND Property to Be Acknowledged as a Foreground Application

https://msdn.microsoft.com/en-us/library/bb756922.aspx

Everything is correctly using the HWND property as far as I can see, is Everything the foreground application when you run a shortcut with run as admin enabled?
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

I run those lnk file directly from Everything with [enter] key so yes, it's the foreground window at that time. I will send you log.

I'm on Win 10 pro x64 french by the way.
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

Log sent now.

Run the admin shortcut start at line 21 237.
void
Developer
Posts: 15038
Joined: Fri Oct 16, 2009 11:31 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by void »

Thanks for the debug log.

The log looks fine, I can't find anything in the log to determine the issue.

What happens if you right click the lnk and click Run as administrator? Is the UAC prompt in the foreground?

Does the problem occur if Always on top is active? (Toggle from View -> On Top -> Always)

In Everything 855b, Everything will make sure the UI window is the foreground window and the top most window before calling ShellExecute.
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

If I run as admin from the context menu in Everything it WORKS. I had not tried that before.

If Always on top is active, NO issue. Thanks. It's fixed with that.
void
Developer
Posts: 15038
Joined: Fri Oct 16, 2009 11:31 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by void »

If Always on top is active, NO issue. Thanks. It's fixed with that.
It's not the best solution, does 855b help?
Looks like the UI window needs to be top most and the foreground window for UAC prompts to get foreground.
fred_gaou
Posts: 9
Joined: Wed Mar 15, 2017 9:39 am

Re: Apps start as ADMIN don't get focus and foreground

Post by fred_gaou »

With v854 with always on top enabled, it seems the issue was partially fixed because it happened again sometimes the UAC window was stuck in taskbar.

I'm pretty sure the issue was triggered if the taskbar is hidden (offscreen) AND if the taskbar is in background too i.e. when a window is maximized, for some reason, the taskbar may switch to the background (as if it was attached to desktop), behind that window and it can NOT be reached and enabled with the mouse. It's a windows 10 bug (maybe 8.1 too) that have never cared to fix. In that case (it happens a lot) I have to press the WIN keyboard key to call it back in foreground.

For now, even if the taskbar isn't reachable with mouse, it seems the issue with UAC popup is fixed with v855 because when I call Everything with my shortkey combination, now it bring the taskbar to the foreground while keeping it hidden (offscreen).

It really seems that the issue is fixed for good even if always on top is always off.

Good work !

Thanks
Coldblackice
Posts: 71
Joined: Sun Jul 13, 2014 12:20 am

Re: Apps start as ADMIN don't get focus and foreground

Post by Coldblackice »

fred_gaou wrote:
Coldblackice wrote:Fred (or anyone), could you explain what you mean by using Everything as your default app launcher for app links in %AppData%? Does this mean just opening a new instance of Everything and searching for an "App*.lnk"? I'm curious how this works, particularly if it's more than merely searching for a program shortcut.
This is the achieved RESULTS of what I mean

When I press Win+N or click on the Everything tray icon, the Everything window start with an Apps filter as default that list only program shortcuts. This way it's quick to start my programs.

But if I need to search for any other things than programs, I just press Ctrl+A to remove the filter and see everything.

Here is my personal settings for that.


Set the needed filters

Create a filter named Apps

Set search pattern as : "exact:type:Shortcut "%APPDATA%\Microsoft\Windows\Start Menu\Programs"|"%SystemDrive%\ProgramData\Microsoft\Windows\Start Menu\Programs"
Macro : ap

Note
  • Replace Shortcut with the valid locale value (it's Raccourci for french).
  • Replace %APPDATA% with C:\Users\{username}\AppData\Roaming
  • Replace %SystemDrive% with the drive letter where Windows is installed (should be C:)
You can use the Advanced search to help yourself to create your own search/filter pattern that will point to the programs shortcuts folders.
------------------
Edit or create the filter named Everything
Set the keyboard shortcut as : Ctrl+A
Leave anything else with blank value.


Set the needed options

Indexes

Note: This my personal choices for indexes settings. Adapt to your own use, the important thing you have to care is that program shortcuts folders have to be indexed.

(Only if you need to exclude everything but the shortcuts program folders) In NTFS>Windows(C:)
include only checked and set %APPDATA%\Microsoft\Windows\Start Menu\Programs;%SystemDrive%\ProgramData\Microsoft\Windows\Start Menu\Programs

(Required if the exclude checkbox set as below are checked) In Folders
Add the same folders as above.

In Exclude
Check all "Exclude box"
Put in Include only files (important is that it must contain all the file type you need to get included the *.lnk for shortcut):
*.bat;*.mkv;*.mp3;*.exe;*.avi;*.mp4;*.png;*.jpg;*.lnk;*.docx;*.pdf;*.xls;*.doc;*.gpx;*.txt;*.rtf;*.sln


General

In Home
  • Search → Custom
  • Filter → Apps
  • View → Use last value
In Keyboard
Toggle window hotkey → Win+N (or whatever you like)
Awesome! Thanks for sharing, and with details. Going to try this myself.
NotNull
Posts: 5142
Joined: Wed May 24, 2017 9:22 pm

Re: Apps start as ADMIN don't get focus and foreground

Post by NotNull »

Bledsoe wrote:How do you turn always on top on?
Menu:View > On Top > Never | Always | While Searching.

This corresponds with INI setting ontop=0|1|2 (resp.)
Post Reply