gmamaladze / globalmousekeyhook

This library allows you to tap keyboard and mouse, detect and record their activity even when an application is inactive and runs in background.
MIT License
1.04k stars 257 forks source link

PowerPoint Addin : Global Key Press Hook doesn't trigger but App Key Press Hook does #162

Open nkimber opened 2 years ago

nkimber commented 2 years ago

The following line: Hook.GlobalEvents().KeyPress+= this.GlobalHookKeyPress; does not trigger within a PowerPoint Addin. However, the following line: Hook.AppEvents().KeyPress+= this.AppHookKeyPress; does trigger the event handler.

This is a problem because if I have a group of shapes selected in PowerPoint and then click a key, the default PowerPoint handler triggers prior to the AppEvents() event, causing an audible 'ding' from PowerPoint before my own code executes. I'm hoping that if I can get the GlobalEvent to trigger, then this will allow be handle the key press before PowerPoint and then set e.Handled=true; preventing PowerPoint from making an audible 'bing'.