Need classlibary to raise an event or fire an event when any of the hot key is pressed.

Sunil A M 171 Reputation points
2022-07-29T15:19:49.273+00:00

Hi Team,

We have requirement to write class library to fire(invoke) an event when any hot key is pressed.
We will subscribe to that event from two application(one is wpf application and also from winui3 application).
Senarios.

  1. Class library to invoke the event when any of the hot key is pressed.
  2. WPF app will subscribe to that event, we ll get notified when hot key is pressed.
  3. WinUI3 app also will subscribe to that event, we ll get notified when hot key is pressed.

Note : we should have functionality like ManagementEventWatcher(notifies when process starts and process stops).

Best Regards,
Sunil

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,679 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
728 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,298 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 11,501 Reputation points Microsoft Vendor
    2022-08-01T02:21:50.843+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Applications can define keyboard shortcuts using Accelerator Tables for themselves Or define a system-wide hot key using RegisterHotKey except System has some hot keys. You can use SetWindowsHookEx to hook any hot key which you are interested in.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.