Page 1 of 1

Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 20 Jun 2019, 05:48
by ciantic
Hello,

I've discovered that with Windows 1903 update the Microsoft has added some global hotkey:

Hold Win+Ctrl+Alt+Shift and then release it will open a Office dialog.

This means that most of the special shortcuts done with Autohotkey are affected, which happen to use that combination. The combination is important because it used to be a safe set of keys we could use for own shortcuts. The shortcut appears to be created by explorer.exe, it stops working if you kill it.

Possible fixes are: Find a way to disable the Office hotkey now globally bind by Windows to Win+Ctrl+Alt+Shift or a new way to make special keys.

As per se this is not AHK bug, but it will affect a lot of scripts I suspect. There is also thread: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=65224

Re: Win+Ctrl+Alt+Shift hotkeys open the Office dialog in Windows 1903

Posted: 21 Jun 2019, 03:15
by lexikos
That's interesting, but I don't get what you're hoping to achieve by posting it in the Bug Reports forum.

I've never wanted to physically or artificially use that combination of keys.

Re: Win+Ctrl+Alt+Shift hotkeys open the Office dialog in Windows 1903

Posted: 21 Jun 2019, 04:51
by ciantic
Actually I thought AHK has a set of hacks to override the other quirks of Windows, by adding a way to disable that would be just one more. I can imagine it's similar problem as overriding Alt+Tab, I don't think it's normally overridable without hacks.

However I do accept this is not bug as such, but real annoyance. This combination is widely used within QMK community, because it's the only combination of modifiers that was unused. So we could use it as own key in keyboard. It was even named as "Hyper" key in QMK / Ergodox EZ keyboard configurator ( https://github.com/qmk/qmk_firmware/blob/master/docs/feature_advanced_keycodes.md ).

What I suggest is a find a way to disable it, and post here as it's found.

Re: Win+Ctrl+Alt+Shift hotkeys open the Office dialog in Windows 1903

Posted: 21 Jun 2019, 05:42
by lexikos
But why in Bug Reports? You want help doing something, there's a place for that. This is not a bug, never mind "as such" or "per se".

AutoHotkey does not have any kind of "hack" to override Alt+Tab, and certainly does not override it by default - you must define a hotkey. There is no reason for AutoHotkey to block this or any other system hotkey by default.

Re: Win+Ctrl+Alt+Shift hotkeys open the Office dialog in Windows 1903

Posted: 21 Jun 2019, 05:52
by ciantic
Okay, can we just move this topic?

To me AHK has always been this magic tool that can override any and all hotkeys, including Windows key, Alt+Tab etc. so when I couldn't override the Office key it seemed to me like a bug.

And I thought it's similar problem as Alt+Tab, since when I bind Alt+Tab the normal behavior is overridden, however if I bind Win+Ctrl+Alt+Shift it still throws me the office dialog (or opens PowerPoint or Word depending what you used e.g. +W or +P).

It is different behavior if you think it like this: you can define alt+tab and it overrides the default behavior, but you can't seem to be able to define Win+Ctrl+Alt+Shift or Win+Ctrl+Alt+Shift+P or Win+Ctrl+Alt+Shift+W which are overridden by explorer.exe no matter what I do from AHK.


Maybe this is closer to feature request, or general discussion.

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 21 Jun 2019, 20:14
by lexikos
I moved and renamed the topic.

AutoHotkey is a user-mode application, not a keyboard driver. We can detect keyboard events only because the system notifies us when they occur. The system always knows that a key is pressed before AutoHotkey does, but the system has multiple levels of processing - including keyboard filter drivers, low level system hotkeys, keyboard hooks, registered hotkeys, keyboard messages posted to the active window, and default processing of those messages. Some hotkeys are implemented in a way that AutoHotkey cannot override; this includes Ctrl+Alt+Del and Win+L, but does not include Win+Ctrl+Alt+Shift.

Alt+Tab and Win+Ctrl+Alt+Shift are not really comparable, because you are not trying to use Tab as a modifier key.


This hook hotkey triggers when you press Alt+Tab, and therefore blocks Tab from any processing that occurs after the keyboard hook, but does not block Alt.

Code: Select all

ListHotkeys
!Tab::MsgBox

This registered hotkey triggers when you press Win+Ctrl+Alt+Shift (Shift must be pressed last). The hotkey is registered with the system, and the system notifies us when it is pressed. Obviously, that means the Shift keypress is seen by the system's hotkey pressing, which would be the logical place for the Office hotkey to be implemented. On Windows 1903, the system apparently launches Office and notifies us that the hotkey was pressed.

Code: Select all

ListHotkeys
#^!Shift::MsgBox

This hook hotkey triggers when you press Win+Ctrl+Alt+Shift, and therefore blocks Shift from subsequent processing, but not Win, Ctrl or Alt. The system's hotkey recognizer sees only Win, Ctrl and Alt, so does not activate the Office hotkey.

Code: Select all

ListHotkeys
$#^!Shift::MsgBox
Of course, since the system's hotkey recognizer does not see Shift, registered hotkeys will only be triggered if they use Win, Ctrl and Alt but not Shift (e.g. #^!a). AutoHotkey's keyboard hook behaves the same; it sees Shift, but knows that the logical state of Shift is "not pressed" (because the hotkey blocked it).

So in short, AutoHotkey does not handle Alt+Tab and Win+Ctrl+Alt+Shift differently; it handles combinations which are already registered hotkeys differently from combinations which are not. You will get more consistent results if you have #UseHook in your script.

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 21 Jun 2019, 20:28
by lexikos
As for Win+Ctrl+Alt+Shift+P or Win+Ctrl+Alt+Shift+W, there is nothing to override, because these are not standard hotkeys. If you define them as hotkeys, AutoHotkey will block P or W, just the same as it would block P or W in ^p:: or +w::.

The problem is that when AutoHotkey blocks P in #^!+p::, the system only sees Win+Ctrl+Alt+Shift, which is the Office hotkey.

By contrast, the hotkeys $!p:: and $#w:: will automatically mask the Alt/Win key. "Masking" the key merely means sending a key as a replacement for the one which was blocked, so that the system will see that the modifier key was used in combination with another key. You can do it manually:
The Start Menu (or the active window's menu bar) can be suppressed by sending any keystroke. The following example disables the ability for the left Win key to activate the Start Menu, while still allowing its use as a modifier:

Code: Select all

~LWin::Send {Blind}{vk07}
Source: #MenuMaskKey - Syntax & Usage | AutoHotkey

Do you see where I'm going with this?

Spoiler

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 22 Jun 2019, 11:23
by ciantic
Thanks! So everyone trying to disable the Office key, here is the snippet of yours that does it:
lexikos wrote:
21 Jun 2019, 20:28

Code: Select all

#^!Shift::
#^+Alt::
#!+Ctrl::
^!+LWin::
^!+RWin::
Send {Blind}{vk07}
return
I think I get this now. However I wouldn't have figured the code above, since it was not intuitive to me, I only tried to disable it by trying to bind this:

Code: Select all

#^+!::
Which didn't work.

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 22 Jun 2019, 17:34
by lexikos
What you wrote is Win+Ctrl+Shift+Exclamation-mark. Modifier symbols must be followed by a key name or character, otherwise they're not modifiers.

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 13 Aug 2019, 16:57
by steve_g
lexikos wrote:
21 Jun 2019, 20:28
As for Win+Ctrl+Alt+Shift+P or Win+Ctrl+Alt+Shift+W, there is nothing to override, because these are not standard hotkeys. If you define them as hotkeys, AutoHotkey will block P or W, just the same as it would block P or W in ^p:: or +w::.


Do you see where I'm going with this?

Spoiler
lexikos- thanks for that. It did not occur to me to do it this way. And bravo on how patient you are.

Re: Prevent Win+Ctrl+Alt+Shift hotkeys from opening the Office dialog in Windows 1903

Posted: 06 Sep 2019, 03:03
by lexikos
By using Process Monitor, I have found another way to prevent Win+Ctrl+Alt+Shift from opening the Office app or website: make it open some other program.

Just set the default value of the registry key HKCR\ms-officeapp\shell\open\command to the path of a program, or the name of a program which the shell can locate, such as cmd. In my case, the HKCR\ms-officeapp\shell and HKCR\ms-officeapp\shell\open keys did not exist (presumably because I removed the Office app), so I created them first. Use HKCU\SOFTWARE\Classes\ms-officeapp\shell\open\command instead to affect only the current user.

This also affects what happens when you run ms-officeapp:. For the other Office apps, I'm guessing some other "ms-" URI schemes would be used, like "ms-powerpoint".

Unfortunately, it seems the Office shortcut only uses this registry value to locate the Office app, and does not use any parameters that may be set. It always passes the parameter Officekey. cmd just ignores it, but notepad gives a warning that "Officekey.txt" does not exist.