diff --git a/PowerToys.sln b/PowerToys.sln index dff6bf1525..cdfa8aaa47 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -93,7 +93,9 @@ Global {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.ActiveCfg = Release|x64 {A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.Build.0 = Release|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.ActiveCfg = Debug|x64 + {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.Build.0 = Debug|x64 {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.ActiveCfg = Release|x64 + {44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.Build.0 = Release|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.ActiveCfg = Debug|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.Build.0 = Debug|x64 {07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.ActiveCfg = Release|x64 diff --git a/src/common/common.h b/src/common/common.h index 1f5f2cc8de..96ee247b52 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include // Returns RECT with positions of the minmize/maximize buttons of the given window. // Does not always work, since some apps draw custom toolbars. diff --git a/src/modules/example_powertoy/dllmain.cpp b/src/modules/example_powertoy/dllmain.cpp index bfa2cdcf3a..18637e5fdb 100644 --- a/src/modules/example_powertoy/dllmain.cpp +++ b/src/modules/example_powertoy/dllmain.cpp @@ -76,7 +76,7 @@ public: } // Return JSON with the configuration options. - virtual bool get_config(wchar_t* buffer, int* buffer_size) override + virtual bool get_config(_Out_ wchar_t* buffer, _Out_ int* buffer_size) override { HINSTANCE hinstance = reinterpret_cast(&__ImageBase); @@ -154,7 +154,7 @@ public: MessageBox(NULL, msg.c_str(), L"Custom action call.", MB_OK | MB_TOPMOST); } } - catch (std::exception& ex) + catch (std::exception& ) { // Improper JSON. } @@ -170,27 +170,31 @@ public: PowerToysSettings::PowerToyValues::from_json_string(config); // Update the bool property. - if (values.is_bool_value(L"test_bool_toggle")) + auto testBoolProp = values.get_bool_value(L"test_bool_toggle"); + if (testBoolProp) { - g_settings.test_bool_prop = values.get_bool_value(L"test_bool_toggle"); + g_settings.test_bool_prop = testBoolProp.value(); } // Update the int property. - if (values.is_int_value(L"test_int_spinner")) + auto testIntSpinner = values.get_int_value(L"test_int_spinner"); + if (testIntSpinner) { - g_settings.test_int_prop = values.get_int_value(L"test_int_spinner"); + g_settings.test_int_prop = testIntSpinner.value(); } // Update the string property. - if (values.is_string_value(L"test_string_text")) + auto testStringText = values.get_string_value(L"test_int_spinner"); + if (testStringText) { - g_settings.test_string_prop = values.get_string_value(L"test_string_text"); + g_settings.test_string_prop = testStringText.value(); } // Update the color property. - if (values.is_string_value(L"test_color_picker")) + auto testColorPicker = values.get_string_value(L"test_color_picker"); + if (testColorPicker) { - g_settings.test_color_prop = values.get_string_value(L"test_color_picker"); + g_settings.test_color_prop = testColorPicker.value(); } // If you don't need to do any custom processing of the settings, proceed @@ -199,7 +203,7 @@ public: // Otherwise call a custom function to process the settings before saving them to disk: // save_settings(); } - catch (std::exception& ex) + catch (std::exception&) { // Improper JSON. } @@ -256,30 +260,34 @@ void ExamplePowertoy::init_settings() PowerToysSettings::PowerToyValues::load_from_settings_file(ExamplePowertoy::get_name()); // Load the bool property. - if (settings.is_bool_value(L"test_bool_toggle")) + auto testBoolToggle = settings.get_bool_value(L"test_bool_toggle"); + if (testBoolToggle) { - g_settings.test_bool_prop = settings.get_bool_value(L"test_bool_toggle"); + g_settings.test_bool_prop = testBoolToggle.value(); } // Load the int property. - if (settings.is_int_value(L"test_int_spinner")) + auto testIntSpinner = settings.get_int_value(L"test_int_spinner"); + if (testIntSpinner) { - g_settings.test_int_prop = settings.get_int_value(L"test_int_spinner"); + g_settings.test_int_prop = testIntSpinner.value(); } // Load the string property. - if (settings.is_string_value(L"test_string_text")) + auto testStringText = settings.get_string_value(L"test_string_text"); + if (testStringText) { - g_settings.test_string_prop = settings.get_string_value(L"test_string_text"); + g_settings.test_string_prop = testStringText.value(); } // Load the color property. - if (settings.is_string_value(L"test_color_picker")) + auto testColorPicker = settings.get_string_value(L"test_color_picker"); + if (testColorPicker) { - g_settings.test_color_prop = settings.get_string_value(L"test_color_picker"); + g_settings.test_color_prop = testColorPicker.value(); } } - catch (std::exception& ex) + catch (std::exception&) { // Error while loading from the settings file. Let default values stay as they are. } @@ -321,7 +329,7 @@ void ExamplePowertoy::save_settings() // Save the PowerToyValues JSON to the power toy settings file. values.save_to_settings_file(); } - catch (std::exception& ex) + catch (std::exception&) { // Couldn't save the settings. } diff --git a/src/modules/example_powertoy/example_powertoy.rc b/src/modules/example_powertoy/example_powertoy.rc index 985e9f0e56..2caf10b5b7 100644 --- a/src/modules/example_powertoy/example_powertoy.rc +++ b/src/modules/example_powertoy/example_powertoy.rc @@ -1,4 +1,4 @@ -ÿþ#include "../common/version.h" +ÿþ#include "../../common/version.h" 1 VERSIONINFO FILEVERSION FILE_VERSION