Disabling the ESC during slideshow in PowerPoint 2016

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

I've been googling for answers, and they all gravitate towards an add-in available at http://skp.mvps.org/noesc.htm.
However, with no "Tools" menu available on PowerPoint 2016, I can't get it to work.
Do people know any other ways?

(The Kiosk mode is not an option for me, because I'm trying to keep myself from accidentally hitting the ESC during presentation. I need the "Presenter View", which is not available in the Kiosk mode.)

User avatar
HansV
Administrator
Posts: 79676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by HansV »

Download the noescape.zip file to a convenient location, then extract NoESCape.ppa to a folder of your choice.

Start PowerPoint.

Select File > Options.
Select Add-ins in the navigation pane on the left.
Select PowerPoint Add-ins from the Manage drop down near the bottom, then click Go...
In the Add-ins dialog, click Add New...
Browse to NoESCape.ppa, select it and click OK.
Then close the Add-ins dialog.

You should now have a new tab in the ribbon: Add-ins, with one button: No ESCape settings.
Click this button, and select one of the options to disable ESCaping from the drop down, then click OK.

S1737.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

Ok, this is strange.
I followed your instruction, but the "Add-in" tab is not appearing in the menu.

As the attached screenshot shows, "Add-ins" is enabled in the ribbon customization.
The weird thing is, when I go to the Ribbon Customization dialog box and press "Ok", I can see a glimpse of the "Add-ins" menu appearing and quickly disappearing in the menu, as if it was trying to make its appearance but something made it go away.

Any idea what's going on?
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 79676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by HansV »

If you select File > Options > Add-ins, is NoESCape listed among the active application add-ins?
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

Yes, it's listed as a PowerPoint add-in under "Active Application Add-ins".

User avatar
HansV
Administrator
Posts: 79676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by HansV »

I tested the add-in in PowerPoint 2021 and it worked as intended.
But when I tried to open the add-in directly, I got a warning about an expired certificate. Perhaps that prevents the add-in from working on your computer. I'm afraid I don't know how to solve that.
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

HansV wrote:
08 Sep 2022, 19:44
I tested the add-in in PowerPoint 2021 and it worked as intended.
But when I tried to open the add-in directly, I got a warning about an expired certificate. Perhaps that prevents the add-in from working on your computer. I'm afraid I don't know how to solve that.
Yes, I got that warning too, but I chose the "use it at my own risk" option. I guess that didn't solve the problem.

User avatar
HansV
Administrator
Posts: 79676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by HansV »

Does it help if you make the folder containing NoESCape.ppa a Trusted Location for PowerPoint?
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

HansV wrote:
08 Sep 2022, 20:08
Does it help if you make the folder containing NoESCape.ppa a Trusted Location for PowerPoint?
Unfortunately, no. :-(

User avatar
HansV
Administrator
Posts: 79676
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by HansV »

I'm out of ideas, sorry.
Best wishes,
Hans

User avatar
SpeakEasy
5StarLounger
Posts: 666
Joined: 27 Jun 2021, 10:46

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by SpeakEasy »

You can do this without the addin. it is almost certainly using a keyboard hook, and we can do the same thing

Just copy and paste this code into a module. Works automatically - ESC is disabled when you start a slideshow, and reenabled when you exit it

Code: Select all

Option Explicit

Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Declare Function GetCurrentThreadId Lib "kernel32" () As Long

Public Const WH_KEYBOARD = 2
Public Const VK_ESCAPE = &H1B

Public hHook As Long

Function KeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Static PrevCode As Long
    If PrevCode <> nCode Then
        PrevCode = nCode

        If nCode >= 0 Then
            'Process keys you want to filter
            Select Case wParam
            Case VK_ESCAPE    'Trap and eat the escape key (by not passing it on for any further processing)
                    KeyboardProc = 1
                    Exit Function
            Case Else
                ' Else
            End Select
        End If
    End If
    ' Allow default keyboard processing
    KeyboardProc = CallNextHookEx(hHook, nCode, wParam, lParam)
End Function

Private Sub HookIt()
    If hHook = 0 Then ' no current hook in place
            hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, 0&, GetCurrentThreadId())
    End If
End Sub

Private Sub UnhookIt()
    Call UnhookWindowsHookEx(hHook)
    hHook = 0
End Sub

Sub OnSlideShowTerminate(ByVal Wnd As Object)
    If hHook Then UnhookIt
End Sub

Sub OnSlideShowPageChange(ByVal Wnd As Object)
    If hHook = 0 Then Call HookIt
End Sub

Sub Auto_Close()
    If hHook Then UnhookIt
End Sub

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: Disabling the ESC during slideshow in PowerPoint 2016

Post by New Daddy »

My belated thanks!
Somehow, your post escaped me.
SpeakEasy wrote:
13 Sep 2022, 10:25
You can do this without the addin. it is almost certainly using a keyboard hook, and we can do the same thing

Just copy and paste this code into a module. Works automatically - ESC is disabled when you start a slideshow, and reenabled when you exit it

Code: Select all

Option Explicit

Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Declare Function GetCurrentThreadId Lib "kernel32" () As Long

Public Const WH_KEYBOARD = 2
Public Const VK_ESCAPE = &H1B

Public hHook As Long

Function KeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Static PrevCode As Long
    If PrevCode <> nCode Then
        PrevCode = nCode

        If nCode >= 0 Then
            'Process keys you want to filter
            Select Case wParam
            Case VK_ESCAPE    'Trap and eat the escape key (by not passing it on for any further processing)
                    KeyboardProc = 1
                    Exit Function
            Case Else
                ' Else
            End Select
        End If
    End If
    ' Allow default keyboard processing
    KeyboardProc = CallNextHookEx(hHook, nCode, wParam, lParam)
End Function

Private Sub HookIt()
    If hHook = 0 Then ' no current hook in place
            hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, 0&, GetCurrentThreadId())
    End If
End Sub

Private Sub UnhookIt()
    Call UnhookWindowsHookEx(hHook)
    hHook = 0
End Sub

Sub OnSlideShowTerminate(ByVal Wnd As Object)
    If hHook Then UnhookIt
End Sub

Sub OnSlideShowPageChange(ByVal Wnd As Object)
    If hHook = 0 Then Call HookIt
End Sub

Sub Auto_Close()
    If hHook Then UnhookIt
End Sub