OnKeyDown event in Word.

Add-in Express™ Support Service
That's what is more important than anything else

OnKeyDown event in Word.
Trapping the F12 key. 
Dave O'Brien




Posts: 51
Joined: 2019-09-02
I can trap the F12 key in the OnKeyDown event and would like to then remove the key so the standard action doesn't also run.

procedure TIDMWordAddInModule.adxCOMAddInModuleKeyDown(Sender: TObject; var args: TadxKeyDownEventArgs);
begin
   if args.VirtualKey = VK_F12 then
   begin
      args.VirtualKey := 0;
      DoStuff;
   end;
end;


In a standard WinForm OnKeyDown I would set the key to 0 and that is that. Is there any way of removing the key after processing?
Posted 19 Jun, 2023 19:30:08 Top