How to get power key current state pressed or not in C#

Sachi 221 Reputation points

I am creating WinUI3 app i want to handle some events.

how to know whether power key status of pressed or not

I want to avoid the condition to go inside if the power key pressed.

please suggest.

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.
7,519 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.
469 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,980 questions
{count} votes