c++uwpwindows-10-mobile

UWP.C++ How to toggle Adaptive Brightness from BackgroudTask


now i have
PointerTo.BrightnessOverride from MyBackgroudTask

aaa_bo = BrightnessOverride::GetDefaultForSystem();// OK VStudio & Phone

I can Set Brightness from BackgroundTask.exe, but How can i toggle Adaptive Brightness ON / OFF ?

I created class NullObject, but still compile error

aa_OBJ_BO->SaveForSystemAsync(NullObject());
Error   C2664   'Windows::Foundation::IAsyncOperation<bool> ^Windows::Graphics::Display::BrightnessOverride::SaveForSystemAsync(Windows::Graphics::Display::BrightnessOverride ^)': cannot convert argument 1 from 'BackgroundTask::NullObject' to 'Windows::Graphics::Display::BrightnessOverride ^'   BackgroundTask  554 1   Build   

private ref class ClsDummy {
        public:
            virtual ~ClsDummy() {};
            virtual void MakeSound() {};
    };
        //Windows::Graphics::Display::BrightnessOverride^
    private ref class NullObject sealed : public ClsDummy {
        public:
            //virtual void MakeSound() const override {};
        virtual void MakeSound() override {};
    };

Solution

  • You could take a look at BrightnessOverride.SaveForSystemAsync(BrightnessOverride) Method. The method mentioned that if a NULL object is passed in, the system turns on auto-brightness. So you might need to call this method with a null value to turn on the auto-brightness.