How to Utilize SetColor(Windows::UI::Colors::Red) from a Non-UWP and Non-C++/WinRT DLL File

sunil maurya 21 Reputation points
2024-06-16T19:14:55.05+00:00

Hi,

I have developed a C++ DLL without utilizing UWP or C++/WinRT. Within this DLL, I am employing Windows::Devices::Lights::LampArray^ lamp to retrieve information about the lamp, such as lamp->IsConnected, lamp->LampCount, and lamp->BrightnessLevel.

However, when attempting to invoke

lamp->SetColor(Windows::UI::Colors::Red) to change the LED color, the LED does not change color. Debugging the driver code revealed that the SetColor() command is not reaching to the driver. Additionally, there are no exceptions thrown since SetColor() has a void return type.

Given my requirement to program the LED color without using UWP/WinRT, due to their tight coupling with UI elements, I seek guidance on how to effectively utilize SetColor(Windows::UI::Colors::Red) in my Win32 DLL code without involving the UI.

I am looking for a solution where a Win32 DLL contains a SetColor() API, and an executable can call this DLL to set the LED color.

Universal Windows Platform (UWP)
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,648 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,754 questions
{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.