How to use C++/WinRt API like as part of DLL without user interface(UI)

sunil maurya 21 Reputation points
2024-04-23T06:41:57.05+00:00

Hi, I am attempting to utilize the C++/WinRT code provided in the sample of LampArray, cppwinrt to create a DLL. However due to the tight coupling of this sample with the UI, I am not able to use below API independently within my DLL code, without incorporating UI Code.

 m_deviceAddedRevoker = m_deviceWatcher.Added(winrt::auto_revoke, { get_weak(), &Scenario1_Basics::Watcher_Added});


    m_deviceRemovedRevoker = m_deviceWatcher.Removed(winrt::auto_revoke, { get_weak(), &Scenario1_Basics::Watcher_Removed });

Could you please guide me on whether there's a method to directly invoke the API in my code without relying on the UWP UI portion?

Note: I am trying to create a DLL to access the lamp devices attached to system like lights/LEDs, etc.

Regard,
Sunil

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.
2,435 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,548 questions
{count} votes