mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Spelling: ... (#3398)
This commit is contained in:
parent
b1554ebf37
commit
4a03756b5b
@ -155,7 +155,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
|
|||||||
// More settings
|
// More settings
|
||||||
...
|
...
|
||||||
|
|
||||||
// Add a custom action property. When using this settings type, the "call_custom_action()" method should be overriden as well.
|
// Add a custom action property. When using this settings type, the "call_custom_action()" method should be overridden as well.
|
||||||
settings.add_custom_action(
|
settings.add_custom_action(
|
||||||
L"test_custom_action", // action name.
|
L"test_custom_action", // action name.
|
||||||
L"This is what a CustomAction property looks like", // label above the field.
|
L"This is what a CustomAction property looks like", // label above the field.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
- [Coding style](style.md).
|
- [Coding style](style.md).
|
||||||
- Try to package new ideas/components into libraries that have nicely defined interfaces.
|
- Try to package new ideas/components into libraries that have nicely defined interfaces.
|
||||||
- Package new ideas into classes or refactor existing ideas into a class as you extend.
|
- Package new ideas into classes or refactor existing ideas into a class as you extend.
|
||||||
- When adding new classes/methos/changing existing code: add new unit tests or update the existing tests.
|
- When adding new classes/methods/changing existing code: add new unit tests or update the existing tests.
|
||||||
|
|
||||||
## Github Workflow
|
## Github Workflow
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ If you're running any application as an administrator (aka elevated) and PowerTo
|
|||||||
|
|
||||||
We understand users will run applications elevated. We do as well. We have two options for you when this scenario happens:
|
We understand users will run applications elevated. We do as well. We have two options for you when this scenario happens:
|
||||||
|
|
||||||
1. **Recommended:** PowerToys will prompt when we detect a process that is elevated. Go to PowerToys settings inside the General Tab and click "Relaunch as adminstrator".
|
1. **Recommended:** PowerToys will prompt when we detect a process that is elevated. Go to PowerToys settings inside the General Tab and click "Relaunch as administrator".
|
||||||
2. Enable "Always run as administrator" in the PowerToys settings.
|
2. Enable "Always run as administrator" in the PowerToys settings.
|
||||||
|
|
||||||
## What is "Run as Administrator" / Elevated processes
|
## What is "Run as Administrator" / Elevated processes
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#### [`main.cpp`](/src/runner/main.cpp)
|
#### [`main.cpp`](/src/runner/main.cpp)
|
||||||
Contains the executable starting point, initialization code and the list of known PowerToys. All singletones are also initialized here at the start. Loads all the powertoys by scanning the `./modules` folder and `enable()`s those makred as enabled in `%LOCALAPPDATA%\Microsoft\PowerToys\settings.json` config. Then it runs [a message loop](https://docs.microsoft.com/en-us/windows/win32/winmsg/using-messages-and-message-queues) for the tray UI. Note that this message loop also [handles lowlevel_keyboard_hook events](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/lowlevel_keyboard_event.cpp#L24).
|
Contains the executable starting point, initialization code and the list of known PowerToys. All singletones are also initialized here at the start. Loads all the powertoys by scanning the `./modules` folder and `enable()`s those marked as enabled in `%LOCALAPPDATA%\Microsoft\PowerToys\settings.json` config. Then it runs [a message loop](https://docs.microsoft.com/en-us/windows/win32/winmsg/using-messages-and-message-queues) for the tray UI. Note that this message loop also [handles lowlevel_keyboard_hook events](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/lowlevel_keyboard_event.cpp#L24).
|
||||||
|
|
||||||
#### [`general_settings.cpp`](./general_settings.cpp)
|
#### [`general_settings.cpp`](./general_settings.cpp)
|
||||||
#### [`powertoy_module.h`](/src/runner/powertoy_module.h) and [`powertoy_module.cpp`](/src/runner/powertoy_module.cpp)
|
#### [`powertoy_module.h`](/src/runner/powertoy_module.h) and [`powertoy_module.cpp`](/src/runner/powertoy_module.cpp)
|
||||||
|
@ -80,7 +80,7 @@ Example module JSON (taken from Shortcut Guide):
|
|||||||
```
|
```
|
||||||
produces this settings screen:
|
produces this settings screen:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Helper methods
|
### Helper methods
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ settings.set_icon_key(L"pt-example");
|
|||||||
settings.add_string(L"string_val", L"Example string label", L"example value");
|
settings.add_string(L"string_val", L"Example string label", L"example value");
|
||||||
settings.add_int_spinner(L"int_val", L"Example int label", 0, 0, 100, 10);
|
settings.add_int_spinner(L"int_val", L"Example int label", 0, 0, 100, 10);
|
||||||
```
|
```
|
||||||
You can then use `std::wstring serialize()` or `bool serialize_to_buffer(wchar_t* buffer, int* uffer_size)` methods to generate output JSON string.
|
You can then use `std::wstring serialize()` or `bool serialize_to_buffer(wchar_t* buffer, int* buffer_size)` methods to generate output JSON string.
|
||||||
|
|
||||||
### Saving settings
|
### Saving settings
|
||||||
Use
|
Use
|
||||||
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
@ -5,4 +5,4 @@ The PowerToys are split into DLLs for each PowerToy module ([`modules`](/src/mod
|
|||||||
|
|
||||||
The settings window is a separate executable, contained in [`settings`](/src/settings) folder. It utilizes a WebView to display an HTML-based settings window (contained in [`settings-web`](/src/settings-web) folder).
|
The settings window is a separate executable, contained in [`settings`](/src/settings) folder. It utilizes a WebView to display an HTML-based settings window (contained in [`settings-web`](/src/settings-web) folder).
|
||||||
|
|
||||||
The [`common`](/src/common) contains code for a static libary with helper functions, used by both the runner and the PowerToys modules.
|
The [`common`](/src/common) contains code for a static library with helper functions, used by both the runner and the PowerToys modules.
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Usage:
|
Usage:
|
||||||
When creating animation contstructor takes one parameter - how long
|
When creating animation constructor takes one parameter - how long
|
||||||
should the animation take in seconds.
|
should the animation take in seconds.
|
||||||
|
|
||||||
Call reset() when starting animation.
|
Call reset() when starting animation.
|
||||||
|
|
||||||
When redering, call value() to get value from 0 to 1 - depending on animation
|
When rendering, call value() to get value from 0 to 1 - depending on animation
|
||||||
progress.
|
progress.
|
||||||
*/
|
*/
|
||||||
class Animation
|
class Animation
|
||||||
|
@ -191,7 +191,7 @@ ShortcutGuideFilter get_shortcutguide_filtered_window()
|
|||||||
// WinKey + Up just won't maximize the window. Similary, without
|
// WinKey + Up just won't maximize the window. Similary, without
|
||||||
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
||||||
// is a example of such window - it can be snapped to both sides and to
|
// is a example of such window - it can be snapped to both sides and to
|
||||||
// all screen conrers, but will not get maximized nor minimized.
|
// all screen corners, but will not get maximized nor minimized.
|
||||||
// For now, since ShortcutGuide can only disable entire "Windows Controls"
|
// For now, since ShortcutGuide can only disable entire "Windows Controls"
|
||||||
// group, we require that the window supports all the options.
|
// group, we require that the window supports all the options.
|
||||||
result.snappable = ((style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX) &&
|
result.snappable = ((style & WS_MAXIMIZEBOX) == WS_MAXIMIZEBOX) &&
|
||||||
@ -577,7 +577,7 @@ std::wstring get_process_path(HWND window) noexcept
|
|||||||
if (name.length() >= app_frame_host.length() &&
|
if (name.length() >= app_frame_host.length() &&
|
||||||
name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0)
|
name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0)
|
||||||
{
|
{
|
||||||
// It is a UWP app. We will enumarate the windows and look for one created
|
// It is a UWP app. We will enumerate the windows and look for one created
|
||||||
// by something with a different PID
|
// by something with a different PID
|
||||||
DWORD new_pid = pid;
|
DWORD new_pid = pid;
|
||||||
EnumChildWindows(
|
EnumChildWindows(
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// Returns RECT with positions of the minmize/maximize buttons of the given window.
|
// Returns RECT with positions of the minimize/maximize buttons of the given window.
|
||||||
// Does not always work, since some apps draw custom toolbars.
|
// Does not always work, since some apps draw custom toolbars.
|
||||||
std::optional<RECT> get_button_pos(HWND hwnd);
|
std::optional<RECT> get_button_pos(HWND hwnd);
|
||||||
// Gets position of given window.
|
// Gets position of given window.
|
||||||
std::optional<RECT> get_window_pos(HWND hwnd);
|
std::optional<RECT> get_window_pos(HWND hwnd);
|
||||||
// Gets mouse postion.
|
// Gets mouse position.
|
||||||
std::optional<POINT> get_mouse_pos();
|
std::optional<POINT> get_mouse_pos();
|
||||||
|
|
||||||
// Test if window can be zoned by FancyZones
|
// Test if window can be zoned by FancyZones
|
||||||
@ -63,7 +63,7 @@ WindowState get_window_state(HWND hwnd);
|
|||||||
// Returns true if the current process is running with elevated privileges
|
// Returns true if the current process is running with elevated privileges
|
||||||
bool is_process_elevated(const bool use_cached_value = true);
|
bool is_process_elevated(const bool use_cached_value = true);
|
||||||
|
|
||||||
// Drops the elevated privilages if present
|
// Drops the elevated privileges if present
|
||||||
bool drop_elevated_privileges();
|
bool drop_elevated_privileges();
|
||||||
|
|
||||||
// Run command as elevated user, returns true if succeeded
|
// Run command as elevated user, returns true if succeeded
|
||||||
@ -72,7 +72,7 @@ bool run_elevated(const std::wstring& file, const std::wstring& params);
|
|||||||
// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL
|
// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL
|
||||||
bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid);
|
bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid);
|
||||||
|
|
||||||
// Run command with the same elevation, returns true if succedded
|
// Run command with the same elevation, returns true if succeeded
|
||||||
bool run_same_elevation(const std::wstring& file, const std::wstring& params);
|
bool run_same_elevation(const std::wstring& file, const std::wstring& params);
|
||||||
|
|
||||||
// Returns true if the current process is running from administrator account
|
// Returns true if the current process is running from administrator account
|
||||||
|
@ -69,7 +69,7 @@ void D2DWindow::base_init()
|
|||||||
&options,
|
&options,
|
||||||
d2d_factory.put_void()));
|
d2d_factory.put_void()));
|
||||||
}
|
}
|
||||||
// For all other stuff - assing nullptr first to release the object, to reset the com_ptr.
|
// For all other stuff - assign nullptr first to release the object, to reset the com_ptr.
|
||||||
d2d_dc = nullptr;
|
d2d_dc = nullptr;
|
||||||
d2d_device = nullptr;
|
d2d_device = nullptr;
|
||||||
dxgi_factory = nullptr;
|
dxgi_factory = nullptr;
|
||||||
|
@ -159,7 +159,7 @@ namespace PowerToysSettings
|
|||||||
{
|
{
|
||||||
auto layout = GetKeyboardLayout(0);
|
auto layout = GetKeyboardLayout(0);
|
||||||
auto scan_code = MapVirtualKeyExW(key_code, MAPVK_VK_TO_VSC_EX, layout);
|
auto scan_code = MapVirtualKeyExW(key_code, MAPVK_VK_TO_VSC_EX, layout);
|
||||||
// Determinate if vk is an extended key. Unfortunatly MAPVK_VK_TO_VSC_EX
|
// Determinate if vk is an extended key. Unfortunately MAPVK_VK_TO_VSC_EX
|
||||||
// does not return correct values.
|
// does not return correct values.
|
||||||
static std::vector<UINT> extended_keys = {
|
static std::vector<UINT> extended_keys = {
|
||||||
VK_APPS,
|
VK_APPS,
|
||||||
|
@ -175,7 +175,7 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="KeyboardManager_ProfileDescription.Text" xml:space="preserve">
|
<data name="KeyboardManager_ProfileDescription.Text" xml:space="preserve">
|
||||||
<value>Select the profile to display the active key remap and shortcuts</value>
|
<value>Select the profile to display the active key remap and shortcuts</value>
|
||||||
<comment>Keyboard Manager configuration dropdown decription</comment>
|
<comment>Keyboard Manager configuration dropdown description</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="KeyboardManager_RemapKeyboardButton.Content" xml:space="preserve">
|
<data name="KeyboardManager_RemapKeyboardButton.Content" xml:space="preserve">
|
||||||
<value>Remap a key</value>
|
<value>Remap a key</value>
|
||||||
|
@ -45,7 +45,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
dispatcher = Window.Current.Dispatcher;
|
dispatcher = Window.Current.Dispatcher;
|
||||||
if (SettingsUtils.SettingsExists(PowerToyName))
|
if (SettingsUtils.SettingsExists(PowerToyName))
|
||||||
{
|
{
|
||||||
// Todo: Be more resillent while reading and saving settings.
|
// Todo: Be more resilient while reading and saving settings.
|
||||||
settings = SettingsUtils.GetSettings<KeyboardManagerSettings>(PowerToyName);
|
settings = SettingsUtils.GetSettings<KeyboardManagerSettings>(PowerToyName);
|
||||||
|
|
||||||
// Load profile.
|
// Load profile.
|
||||||
@ -158,8 +158,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
private async void OnConfigFileUpdate()
|
private async void OnConfigFileUpdate()
|
||||||
{
|
{
|
||||||
// Note: FileSystemWatcher raise notification mutiple times for single update operation.
|
// Note: FileSystemWatcher raise notification multiple times for single update operation.
|
||||||
// Todo: Handle duplicate events either by somehow supress them or re-read the configuration everytime since we will be updating the UI only if something is changed.
|
// Todo: Handle duplicate events either by somehow suppress them or re-read the configuration everytime since we will be updating the UI only if something is changed.
|
||||||
if (LoadProfile())
|
if (LoadProfile())
|
||||||
{
|
{
|
||||||
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||||
|
@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
public sealed partial class ShellPage : UserControl
|
public sealed partial class ShellPage : UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delcaration for the ipc callback function.
|
/// Declaration for the ipc callback function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg">message.</param>
|
/// <param name="msg">message.</param>
|
||||||
public delegate void IPCMessageCallback(string msg);
|
public delegate void IPCMessageCallback(string msg);
|
||||||
|
@ -12,7 +12,7 @@ namespace CommonLibTest
|
|||||||
{
|
{
|
||||||
// Work around for System.JSON required properties:
|
// Work around for System.JSON required properties:
|
||||||
// https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.
|
// https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.
|
||||||
// Test also failes when the attributes are not initiliazed i.e they have null values.
|
// Test also fails when the attributes are not initialized i.e they have null values.
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public void ToJsonString_ShouldReturnValidJSONOfModel_WhenSuccessful()
|
public void ToJsonString_ShouldReturnValidJSONOfModel_WhenSuccessful()
|
||||||
|
@ -58,7 +58,7 @@ namespace ViewModelTests
|
|||||||
ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel();
|
ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// Initilize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
ShellPage.DefaultSndMSGCallback = msg =>
|
ShellPage.DefaultSndMSGCallback = msg =>
|
||||||
{
|
{
|
||||||
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
|
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
|
||||||
@ -77,7 +77,7 @@ namespace ViewModelTests
|
|||||||
Assert.AreEqual(1, viewModel.ThemeIndex);
|
Assert.AreEqual(1, viewModel.ThemeIndex);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// Initilize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
ShellPage.DefaultSndMSGCallback = msg =>
|
ShellPage.DefaultSndMSGCallback = msg =>
|
||||||
{
|
{
|
||||||
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
||||||
@ -96,7 +96,7 @@ namespace ViewModelTests
|
|||||||
Assert.AreEqual(900, viewModel.PressTime);
|
Assert.AreEqual(900, viewModel.PressTime);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// Initilize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
ShellPage.DefaultSndMSGCallback = msg =>
|
ShellPage.DefaultSndMSGCallback = msg =>
|
||||||
{
|
{
|
||||||
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
||||||
@ -115,7 +115,7 @@ namespace ViewModelTests
|
|||||||
Assert.AreEqual(90, viewModel.OverlayOpacity);
|
Assert.AreEqual(90, viewModel.OverlayOpacity);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// Initilize mock function of sending IPC message.
|
// Initialize mock function of sending IPC message.
|
||||||
ShellPage.DefaultSndMSGCallback = msg =>
|
ShellPage.DefaultSndMSGCallback = msg =>
|
||||||
{
|
{
|
||||||
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
ShortcutGuideSettingsIPCMessage snd = JsonSerializer.Deserialize<ShortcutGuideSettingsIPCMessage>(msg);
|
||||||
|
@ -120,7 +120,7 @@ int runner(bool isProcessElevated)
|
|||||||
notifications::register_background_toast_handler();
|
notifications::register_background_toast_handler();
|
||||||
|
|
||||||
chdir_current_executable();
|
chdir_current_executable();
|
||||||
// Load Powertyos DLLS
|
// Load Powertoys DLLS
|
||||||
// For now only load known DLLs
|
// For now only load known DLLs
|
||||||
|
|
||||||
std::wstring baseModuleFolder = L"modules/";
|
std::wstring baseModuleFolder = L"modules/";
|
||||||
|
@ -30,7 +30,7 @@ std::wstring get_process_path(HWND window) noexcept
|
|||||||
if (name.length() >= app_frame_host.length() &&
|
if (name.length() >= app_frame_host.length() &&
|
||||||
name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0)
|
name.compare(name.length() - app_frame_host.length(), app_frame_host.length(), app_frame_host) == 0)
|
||||||
{
|
{
|
||||||
// It is a UWP app. We will enumarate the windows and look for one created
|
// It is a UWP app. We will enumerate the windows and look for one created
|
||||||
// by something with a different PID
|
// by something with a different PID
|
||||||
DWORD new_pid = pid;
|
DWORD new_pid = pid;
|
||||||
EnumChildWindows(window, [](HWND hwnd, LPARAM param) -> BOOL {
|
EnumChildWindows(window, [](HWND hwnd, LPARAM param) -> BOOL {
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return array of the names of all events that this powertoy listens for, with
|
// Return array of the names of all events that this powertoy listens for, with
|
||||||
// nullptr as the last element of the array. Nullptr can also be retured for empty
|
// nullptr as the last element of the array. Nullptr can also be returned for empty
|
||||||
// list.
|
// list.
|
||||||
virtual const wchar_t** get_events() override
|
virtual const wchar_t** get_events() override
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ public:
|
|||||||
//);
|
//);
|
||||||
|
|
||||||
// A custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
// A custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
||||||
// method should be overriden as well.
|
// method should be overridden as well.
|
||||||
//settings.add_custom_action(
|
//settings.add_custom_action(
|
||||||
// L"custom_action_id", // action name.
|
// L"custom_action_id", // action name.
|
||||||
// L"This is what a CustomAction property looks like", // label above the field.
|
// L"This is what a CustomAction property looks like", // label above the field.
|
||||||
|
@ -104,7 +104,7 @@ Here's an example from [the example PowerToy implementation](/src/modules/exampl
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add a custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
// Add a custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
||||||
// method should be overriden as well.
|
// method should be overridden as well.
|
||||||
settings.add_custom_action(
|
settings.add_custom_action(
|
||||||
L"test_custom_action", // action name.
|
L"test_custom_action", // action name.
|
||||||
L"This is what a CustomAction property looks like", // label above the field.
|
L"This is what a CustomAction property looks like", // label above the field.
|
||||||
@ -174,7 +174,7 @@ or
|
|||||||
```cpp
|
```cpp
|
||||||
settings.set_description(description_resource_id);
|
settings.set_description(description_resource_id);
|
||||||
```
|
```
|
||||||
where `description_resource_id` is the UINT index of a resouce string in the project .rc file.
|
where `description_resource_id` is the UINT index of a resource string in the project .rc file.
|
||||||
|
|
||||||
#### icon_key
|
#### icon_key
|
||||||
The identifier of the PowerToy icon in the [`settings-web` project](/src/settings-web#updating-the-icons).
|
The identifier of the PowerToy icon in the [`settings-web` project](/src/settings-web#updating-the-icons).
|
||||||
@ -297,7 +297,7 @@ A custom action property, invoked from the settings by a Button control. This ca
|
|||||||
It can be added to a `Settings` object by calling `add_custom_action`.
|
It can be added to a `Settings` object by calling `add_custom_action`.
|
||||||
```cpp
|
```cpp
|
||||||
// Add a custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
// Add a custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
||||||
// method should be overriden as well.
|
// method should be overridden as well.
|
||||||
settings.add_custom_action(
|
settings.add_custom_action(
|
||||||
L"test_custom_action", // action name.
|
L"test_custom_action", // action name.
|
||||||
L"This is what a CustomAction property looks like", // label above the field: a string literal or a resource id
|
L"This is what a CustomAction property looks like", // label above the field: a string literal or a resource id
|
||||||
|
Loading…
Reference in New Issue
Block a user