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 development Windows API - Win32
Developer technologies C++
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.