mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-23 19:49:17 +08:00
[Docs]Replace docs.micrososft.com with learn.microsoft.com (#20662)
* Update SUPPORT.md * Update runner.md * Update guidance.md * Update convert-stringtable-to-resx.ps1 * Update readme.md * Update ControlType.cs * Update README.md * Update CLSID.h * Update GenericProperty`1.cs * Update project-overview.md * Update interop.cpp * Update PreviewHandlerBase.cs * Update indexer.md * Update common.md * Update two_way_pipe_message_ipc.cpp * Update PowerToys.exe.manifest * Update HotkeySettings.cs * push * Update src/tests/win-app-driver/README.md * Update doc/devdocs/akaLinks.md * Update doc/devdocs/modules/launcher/plugins/registry.md
This commit is contained in:
parent
7c0bf9f1f4
commit
4e202e4523
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://docs.microsoft.com/windows/dev-environment/overview), head over to [docs.microsoft.com][usingPowerToys-docs-link]!
|
Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]!
|
||||||
|
|
||||||
| | Current utilities: | |
|
| | Current utilities: | |
|
||||||
|--------------|--------------------|--------------|
|
|--------------|--------------------|--------------|
|
||||||
@ -31,7 +31,7 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
|||||||
- Our installer will install the following items:
|
- Our installer will install the following items:
|
||||||
- [.NET 6.0.8 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/6.0#runtime-desktop-6.0.8) or a newer 6.0.x runtime.
|
- [.NET 6.0.8 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/6.0#runtime-desktop-6.0.8) or a newer 6.0.x runtime.
|
||||||
- [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version.
|
- [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version.
|
||||||
- [Microsoft Visual C++ Redistributable](https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) installer. This will install one of the latest versions available.
|
- [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) installer. This will install one of the latest versions available.
|
||||||
|
|
||||||
### Via GitHub with EXE [Recommended]
|
### Via GitHub with EXE [Recommended]
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## How to use Microsoft PowerToys
|
## How to use Microsoft PowerToys
|
||||||
|
|
||||||
For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://docs.microsoft.com/windows/dev-environment/overview), head over to [docs.microsoft.com][usingPowerToys-docs-link]!
|
For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]!
|
||||||
|
|
||||||
## How to file issues and get help
|
## How to file issues and get help
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
| powertoys-license | https://github.com/microsoft/PowerToys/blob/main/LICENSE |
|
| powertoys-license | https://github.com/microsoft/PowerToys/blob/main/LICENSE |
|
||||||
| powertoys | https://github.com/microsoft/PowerToys |
|
| powertoys | https://github.com/microsoft/PowerToys |
|
||||||
| PowerToysAppCompat | https://github.com/microsoft/PowerToys/wiki/Application-Compatibility |
|
| PowerToysAppCompat | https://github.com/microsoft/PowerToys/wiki/Application-Compatibility |
|
||||||
| powerToysCannotRemapKeys | https://docs.microsoft.com/windows/powertoys/keyboard-manager#keys-that-cannot-be-remapped |
|
| powerToysCannotRemapKeys | https://learn.microsoft.com/windows/powertoys/keyboard-manager#keys-that-cannot-be-remapped |
|
||||||
| powerToysColorPickerImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/ColorPicker_small.png |
|
| powerToysColorPickerImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/ColorPicker_small.png |
|
||||||
| powerToysColorPickerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ColorPicker_large.png |
|
| powerToysColorPickerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ColorPicker_large.png |
|
||||||
| powertoysDetectedElevatedHelp | https://docs.microsoft.com/windows/powertoys/administrator |
|
| powertoysDetectedElevatedHelp | https://learn.microsoft.com/windows/powertoys/administrator |
|
||||||
| powertoys-docs | https://docs.microsoft.com/windows/powertoys/?WT.mc_id=twitter-0000-docsmsft |
|
| powertoys-docs | https://learn.microsoft.com/windows/powertoys |
|
||||||
| powerToysFancyZoneImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/FancyZones_small.png |
|
| powerToysFancyZoneImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/FancyZones_small.png |
|
||||||
| powerToysFancyZoneSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/FancyZones_large.png |
|
| powerToysFancyZoneSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/FancyZones_large.png |
|
||||||
| powerToysGiveFeedback | https://github.com/microsoft/PowerToys/issues |
|
| powerToysGiveFeedback | https://github.com/microsoft/PowerToys/issues |
|
||||||
@ -19,17 +19,17 @@
|
|||||||
| powerToysImageResizerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ImageResizer_large.png |
|
| powerToysImageResizerSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/ImageResizer_large.png |
|
||||||
| powerToysKBMImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/KBM_small.png |
|
| powerToysKBMImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/KBM_small.png |
|
||||||
| powerToysKBMSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/KBM_large.png |
|
| powerToysKBMSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/KBM_large.png |
|
||||||
| PowerToysOverview | https://docs.microsoft.com/windows/powertoys/ |
|
| PowerToysOverview | https://learn.microsoft.com/windows/powertoys/ |
|
||||||
| PowerToysOverview_ColorPicker | https://docs.microsoft.com/windows/powertoys/color-picker |
|
| PowerToysOverview_ColorPicker | https://learn.microsoft.com/windows/powertoys/color-picker |
|
||||||
| PowerToysOverview_FancyZones | https://docs.microsoft.com/windows/powertoys/fancyzones |
|
| PowerToysOverview_FancyZones | https://learn.microsoft.com/windows/powertoys/fancyzones |
|
||||||
| PowerToysOverview_FileExplorerAddOns | https://docs.microsoft.com/windows/powertoys/file-explorer |
|
| PowerToysOverview_FileExplorerAddOns | https://learn.microsoft.com/windows/powertoys/file-explorer |
|
||||||
| PowerToysOverview_ImageResizer | https://docs.microsoft.com/windows/powertoys/image-resizer |
|
| PowerToysOverview_ImageResizer | https://learn.microsoft.com/windows/powertoys/image-resizer |
|
||||||
| PowerToysOverview_KeyboardManager | https://docs.microsoft.com/windows/powertoys/keyboard-manager |
|
| PowerToysOverview_KeyboardManager | https://learn.microsoft.com/windows/powertoys/keyboard-manager |
|
||||||
| PowerToysOverview_MouseUtilities | https://docs.microsoft.com/windows/powertoys/mouse-utilities |
|
| PowerToysOverview_MouseUtilities | https://learn.microsoft.com/windows/powertoys/mouse-utilities |
|
||||||
| PowerToysOverview_PowerRename | https://docs.microsoft.com/windows/powertoys/powerrename |
|
| PowerToysOverview_PowerRename | https://learn.microsoft.com/windows/powertoys/powerrename |
|
||||||
| PowerToysOverview_PowerToysRun | https://docs.microsoft.com/windows/powertoys/run |
|
| PowerToysOverview_PowerToysRun | https://learn.microsoft.com/windows/powertoys/run |
|
||||||
| PowerToysOverview_ShortcutGuide | https://docs.microsoft.com/windows/powertoys/shortcut-guide |
|
| PowerToysOverview_ShortcutGuide | https://learn.microsoft.com/windows/powertoys/shortcut-guide |
|
||||||
| PowerToysOverview_VideoConference | https://docs.microsoft.com/windows/powertoys/video-conference-mute |
|
| PowerToysOverview_VideoConference | https://learn.microsoft.com/windows/powertoys/video-conference-mute |
|
||||||
| powerToysPowerLauncherImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerLauncher_small.png |
|
| powerToysPowerLauncherImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerLauncher_small.png |
|
||||||
| powerToysPowerLauncherSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/PowerLauncher_large.png |
|
| powerToysPowerLauncherSettingImage | https://raw.githubusercontent.com/microsoft/PowerToys/main/doc/images/overview/PowerLauncher_large.png |
|
||||||
| powerToysPowerPreviewImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerPreview_small.png |
|
| powerToysPowerPreviewImageSmall | https://github.com/microsoft/PowerToys/wiki/images/overview/PowerPreview_small.png |
|
||||||
|
@ -95,6 +95,6 @@ namespace
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://docs.microsoft.com/en-US/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the rationale of the current design [here](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337).
|
Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the rationale of the current design [here](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337).
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ Please review these brief docs below relating to our coding standards etc.
|
|||||||
* [Code Organization](./readme.md)
|
* [Code Organization](./readme.md)
|
||||||
|
|
||||||
|
|
||||||
[VS Resource Editor]: https://docs.microsoft.com/en-us/cpp/windows/resource-editors?view=vs-2019
|
[VS Resource Editor]: https://learn.microsoft.com/cpp/windows/resource-editors?view=vs-2019
|
||||||
[String Table]: https://docs.microsoft.com/en-us/windows/win32/menurc/stringtable-resource
|
[String Table]: https://learn.microsoft.com/windows/win32/menurc/stringtable-resource
|
||||||
[Resx Files VS]: https://docs.microsoft.com/en-us/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resource-files-in-visual-studio
|
[Resx Files VS]: https://learn.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resource-files-in-visual-studio
|
||||||
[Resx Files]: https://docs.microsoft.com/en-us/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resources-in-resx-files
|
[Resx Files]: https://learn.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resources-in-resx-files
|
||||||
[Resource Manager]: https://docs.microsoft.com/en-us/dotnet/api/system.resources.resourcemanager?view=netframework-4.8
|
[Resource Manager]: https://learn.microsoft.com/dotnet/api/system.resources.resourcemanager?view=netframework-4.8
|
||||||
|
@ -50,7 +50,7 @@ The rest of the steps depend on the project type and are covered in the sections
|
|||||||
### C++
|
### C++
|
||||||
C++ projects do not support `resx` files, and instead use `rc` files along with `resource.h` files. The CDPX pipeline however doesn't support localizing `rc` files and the other alternative they support is directly translating the resources from the binary which makes it harder to maintain resources. To avoid this, a custom script has been added which expects a resx file and converts the entries to an rc file with a string table and adds resource declarations to a resource.h file so that the resources can be compiled with the C++ project.
|
C++ projects do not support `resx` files, and instead use `rc` files along with `resource.h` files. The CDPX pipeline however doesn't support localizing `rc` files and the other alternative they support is directly translating the resources from the binary which makes it harder to maintain resources. To avoid this, a custom script has been added which expects a resx file and converts the entries to an rc file with a string table and adds resource declarations to a resource.h file so that the resources can be compiled with the C++ project.
|
||||||
|
|
||||||
If you already have a .rc file, copy the string table to a separate txt file and run the [convert-stringtable-to-resx.ps1](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-stringtable-to-resx.ps1) script on it. This script is not very robust to input, and requires the data in a specific format, where `IDS_ResName L"ResourceValue"` and any number of spaces can be present in between. The script converts this file to the format expected by [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert), which will convert it to resx. The resource names are changed from all uppercase to title case, and the `IDS_` prefix is removed. Escape characters might have to be manually replaced, for example .rc files would have escaped double quotes as `""`, so this should be replaced with just `"` before converting to the resx files.
|
If you already have a .rc file, copy the string table to a separate txt file and run the [convert-stringtable-to-resx.ps1](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-stringtable-to-resx.ps1) script on it. This script is not very robust to input, and requires the data in a specific format, where `IDS_ResName L"ResourceValue"` and any number of spaces can be present in between. The script converts this file to the format expected by [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert), which will convert it to resx. The resource names are changed from all uppercase to title case, and the `IDS_` prefix is removed. Escape characters might have to be manually replaced, for example .rc files would have escaped double quotes as `""`, so this should be replaced with just `"` before converting to the resx files.
|
||||||
|
|
||||||
After generating the resx file, rename the existing rc and h files to ProjName.base.rc and resource.base.h. In the rc file remove the string table which is to be localized and in the .h file remove all `#define`s corresponding to localized resources. In the vcxproj of the C++ project, add the following build event:
|
After generating the resx file, rename the existing rc and h files to ProjName.base.rc and resource.base.h. In the rc file remove the string table which is to be localized and in the .h file remove all `#define`s corresponding to localized resources. In the vcxproj of the C++ project, add the following build event:
|
||||||
```
|
```
|
||||||
@ -59,7 +59,7 @@ After generating the resx file, rename the existing rc and h files to ProjName.b
|
|||||||
</Target>
|
</Target>
|
||||||
```
|
```
|
||||||
|
|
||||||
This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script can be found [here](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format:
|
This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script can be found [here](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format:
|
||||||
```
|
```
|
||||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
@ -88,7 +88,7 @@ Since C# projects natively support `resx` files, the only step required here is
|
|||||||
|
|
||||||
**Note:** Building with localized resources may cause a build warning `Referenced assembly 'mscorlib.dll' targets a different processor` which is a VS bug. More details can be found [here](https://github.com/microsoft/PowerToys/issues/7269).
|
**Note:** Building with localized resources may cause a build warning `Referenced assembly 'mscorlib.dll' targets a different processor` which is a VS bug. More details can be found [here](https://github.com/microsoft/PowerToys/issues/7269).
|
||||||
|
|
||||||
**Note:** If a project needs to be migrated from XAML resources to resx, the easiest way to convert the resources would be to change to format to `=` separates resources by either manually (by Ctrl+H on a text editor), or by a script, and then running [`resgen`](https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) on `Developer Command Prompt for VS` to convert it to resx format.
|
**Note:** If a project needs to be migrated from XAML resources to resx, the easiest way to convert the resources would be to change to format to `=` separates resources by either manually (by Ctrl+H on a text editor), or by a script, and then running [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) on `Developer Command Prompt for VS` to convert it to resx format.
|
||||||
```
|
```
|
||||||
<system:String x:Key="wox_plugin_calculator_plugin_name">Calculator</system:String>
|
<system:String x:Key="wox_plugin_calculator_plugin_name">Calculator</system:String>
|
||||||
<system:String x:Key="wox_plugin_calculator_plugin_description">Allows to do mathematical calculations.(Try 5*3-2 in Wox)</system:String>
|
<system:String x:Key="wox_plugin_calculator_plugin_description">Allows to do mathematical calculations.(Try 5*3-2 in Wox)</system:String>
|
||||||
|
@ -66,15 +66,15 @@ This file contains documentation for all the methods involved in key/shortcut re
|
|||||||
[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L126-L176) was added to support a feature for converting the behavior of a key from behaving like a toggle (like Caps Lock/Num Lock) to a modifier (like Ctrl), such that when you hold Caps Lock it would behave as if Caps Lock was active, and when it was not pressed Caps Lock would be off. For Caps Lock this would be similar to behaving like Shift, but for Num Lock there is no existing key which can substitute for this. This was added while testing out remapping for the KBM PoC, but wasn't added as a feature since it wasn't a priority.
|
[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L126-L176) was added to support a feature for converting the behavior of a key from behaving like a toggle (like Caps Lock/Num Lock) to a modifier (like Ctrl), such that when you hold Caps Lock it would behave as if Caps Lock was active, and when it was not pressed Caps Lock would be off. For Caps Lock this would be similar to behaving like Shift, but for Num Lock there is no existing key which can substitute for this. This was added while testing out remapping for the KBM PoC, but wasn't added as a feature since it wasn't a priority.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
In order to test the remapping logic, a mocked keyboard input handler had to be created because otherwise the tests would process and send actual key events. For this the [`InputInterface`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/InputInterface.h) was made, and in production code the methods are implemented using [`SendInput`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput) and [`GetAsyncKeyState`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getasynckeystate). In addition to this, [`GetCurrentApplication`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L226-L268) had to be mocked so that app-specific remapping can be tested.
|
In order to test the remapping logic, a mocked keyboard input handler had to be created because otherwise the tests would process and send actual key events. For this the [`InputInterface`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/InputInterface.h) was made, and in production code the methods are implemented using [`SendInput`](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput) and [`GetAsyncKeyState`](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-getasynckeystate). In addition to this, [`GetCurrentApplication`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L226-L268) had to be mocked so that app-specific remapping can be tested.
|
||||||
|
|
||||||
### MockedInput
|
### MockedInput
|
||||||
The [`MockedInput`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/MockedInput.h) class uses a 256 size `bool` vector to store the key state for each key code. Identifying the foreground process is mocked by simply setting and getting a string value for the name of the current process.
|
The [`MockedInput`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/MockedInput.h) class uses a 256 size `bool` vector to store the key state for each key code. Identifying the foreground process is mocked by simply setting and getting a string value for the name of the current process.
|
||||||
|
|
||||||
[To mock the `SendInput` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L10-L110), the steps for processing the input are as follows. This implementation is based on public documentation for SendInput and the behavior of key messages and keyboard hooks:
|
[To mock the `SendInput` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L10-L110), the steps for processing the input are as follows. This implementation is based on public documentation for SendInput and the behavior of key messages and keyboard hooks:
|
||||||
- Iterate over all the inputs in the INPUT array argument
|
- Iterate over all the inputs in the INPUT array argument
|
||||||
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-syskeyup) if Alt is held down, otherwise it is `WM_KEYUP`.
|
- If the event is a key up event, then it is considered [`WM_SYSKEYUP`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeyup) if Alt is held down, otherwise it is `WM_KEYUP`.
|
||||||
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10, otherwise it is `WM_KEYDOWN`.
|
- If the event is a key down event, then it is considered [`WM_SYSKEYDOWN`](https://learn.microsoft.com/windows/win32/inputdev/wm-syskeydown) if either Alt is held down or if it is F10, otherwise it is `WM_KEYDOWN`.
|
||||||
- An optional function which can be set on the `MockedInput` handler can be used to test for the number of times a key event is received by the system with a particular condition using [`sendVirtualInputCallCondition`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L48-L52).
|
- An optional function which can be set on the `MockedInput` handler can be used to test for the number of times a key event is received by the system with a particular condition using [`sendVirtualInputCallCondition`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/MockedInput.cpp#L48-L52).
|
||||||
- The hook logic for a low level hook which returns 0 or 1 can be set on the `MockedInput` handler such that it behaves like a low level hook would behave with actual keyboard input. If the method returns 1, then the keyboard state is not updated, and if it returns 0 the corresponding key event is used to update the key state. This works in the recursive way as well similar to low level hooks, as `SendVirtualInput` can be called from within the hook, thus simulating identical behavior to calling `SendInput` in a low level hook (as soon as SendInput is called, the low level hook is called for the new input event, and only after those are processed it returns back to the current event, check this [blog](https://devblogs.microsoft.com/oldnewthing/20140213-00/?p=1773) for more details).
|
- The hook logic for a low level hook which returns 0 or 1 can be set on the `MockedInput` handler such that it behaves like a low level hook would behave with actual keyboard input. If the method returns 1, then the keyboard state is not updated, and if it returns 0 the corresponding key event is used to update the key state. This works in the recursive way as well similar to low level hooks, as `SendVirtualInput` can be called from within the hook, thus simulating identical behavior to calling `SendInput` in a low level hook (as soon as SendInput is called, the low level hook is called for the new input event, and only after those are processed it returns back to the current event, check this [blog](https://devblogs.microsoft.com/oldnewthing/20140213-00/?p=1773) for more details).
|
||||||
- For updating the keyboard state, KEYUP messages result in the state for that key code being set to false, and KEYDOWN result in the state for that key code being set to true.
|
- For updating the keyboard state, KEYUP messages result in the state for that key code being set to false, and KEYDOWN result in the state for that key code being set to true.
|
||||||
|
@ -27,7 +27,7 @@ The `KeyboardManager` module has [3 main class members](https://github.com/micro
|
|||||||
- An object of type `KeyboardManagerState`. This object contains all the data related to remappings and is also used in the sense of a View Model as it used to communicate common data that is shared between the KBM UI and the backend. This class is described in more detail [here](keyboardmanagercommon.md#keyboardmanagerstate).
|
- An object of type `KeyboardManagerState`. This object contains all the data related to remappings and is also used in the sense of a View Model as it used to communicate common data that is shared between the KBM UI and the backend. This class is described in more detail [here](keyboardmanagercommon.md#keyboardmanagerstate).
|
||||||
|
|
||||||
## Enable/Disable
|
## Enable/Disable
|
||||||
On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the last hook to be registered receives the input first as mentioned [here](https://docs.microsoft.com/en-us/windows/win32/winmsg/about-hooks#hook-procedures)).
|
On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the last hook to be registered receives the input first as mentioned [here](https://learn.microsoft.com/windows/win32/winmsg/about-hooks#hook-procedures)).
|
||||||
|
|
||||||
In addition to stopping the hook, any active KBM UI windows are also closed on disabling. This is done because the KBM UI uses the same keyboard hook for the Type button where you can type a key/shortcut, so if KBM is disabled the windows would not be completely functional.
|
In addition to stopping the hook, any active KBM UI windows are also closed on disabling. This is done because the KBM UI uses the same keyboard hook for the Type button where you can type a key/shortcut, so if KBM is disabled the windows would not be completely functional.
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/
|
|||||||
## SendInput Special Scenarios
|
## SendInput Special Scenarios
|
||||||
|
|
||||||
### Extended keys
|
### Extended keys
|
||||||
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found [here](https://docs.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag).
|
Certain keys such as the arrow keys, <kbd>right Ctrl/Alt</kbd>, and <kbd>Del/Home/Ins</kbd>, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found [here](https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#extended-key-flag).
|
||||||
|
|
||||||
The weird behavior that is caused by this can be found at these issues:
|
The weird behavior that is caused by this can be found at these issues:
|
||||||
- https://github.com/microsoft/PowerToys/issues/3478
|
- https://github.com/microsoft/PowerToys/issues/3478
|
||||||
@ -173,7 +173,7 @@ For example, while [remapping <kbd>Ctrl</kbd> to <kbd>Caps Lock</kbd>](https://g
|
|||||||
While the above work around fixes most of the cases, there are still some scenarios where the modifier can get stuck, mentioned at this [comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-663729278), which is why the issue is still open. This occurs if a modifier is pressed after the remap has been invoked before releasing the remapped key and it is a harder scenario to solve which requires refactoring the single key remap code.
|
While the above work around fixes most of the cases, there are still some scenarios where the modifier can get stuck, mentioned at this [comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-663729278), which is why the issue is still open. This occurs if a modifier is pressed after the remap has been invoked before releasing the remapped key and it is a harder scenario to solve which requires refactoring the single key remap code.
|
||||||
|
|
||||||
### UIPI Issues (not resolved)
|
### UIPI Issues (not resolved)
|
||||||
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
|
`SendInput` does not work directly with certain key codes such as Play/Pause Media, Calculator key, etc as it requires UAC privileges to be injected to the OS and accordingly play the active media app or launch the Calculator app. In order to resolve this the correct approach is that the executable which calls `SendInput` needs to have the [UIAccess flag](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview) set to true, which will also avoid the requirement of KBM having to run as administrator to intercept key events when an elevated window is in focus. The UIAccess flag has many constraints such as it must be a signed executable and must be located in a protected path like Program Files. Since KBM currently runs out of the runner process, it would make more sense to do this work after KBM is moved to a separate executable, and it could be enabled by a separate toggle in settings only if PowerToys is installed in Program Files. [This comment](https://github.com/microsoft/PowerToys/issues/3192#issuecomment-646323661) has more details on this approach and (this)[https://github.com/microsoft/PowerToys/issues/3255] is the tracking issue.
|
||||||
|
|
||||||
## Other remapping approaches
|
## Other remapping approaches
|
||||||
Other approaches for remapping which were deprioritized are:
|
Other approaches for remapping which were deprioritized are:
|
||||||
|
@ -28,7 +28,7 @@ The windows are [created as C++ windows](https://github.com/microsoft/PowerToys/
|
|||||||
|
|
||||||
Once the UI controls are created, the parent container is set as the content for the `DesktopWindowXamlSource` and the `XamlBridge.MessageLoop` is executed. Messages are processed by the C++ window handler like [`EditKeyboardWindowProc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L364-L404). The general structure we use for this is, for any `WM_PAINT` or `WM_SIZE` message we resize the Xaml Island window. For `WM_GETMINMAXINFO` we set minimum widths so that the window cannot be resized beyond a minimum height and width. This is done to prevent the WinUI elements from overlapping and getting cropped. If it is neither of these cases we send the message to the [`XamlBridge.MessageHandler`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/XamlBridge.cpp#L291-L301) which handles Destroy, Activation and Focus. If `WM_NCDESTROY` is received when the `XamlBridge` is `nullptr`, the window thread is terminated.
|
Once the UI controls are created, the parent container is set as the content for the `DesktopWindowXamlSource` and the `XamlBridge.MessageLoop` is executed. Messages are processed by the C++ window handler like [`EditKeyboardWindowProc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L364-L404). The general structure we use for this is, for any `WM_PAINT` or `WM_SIZE` message we resize the Xaml Island window. For `WM_GETMINMAXINFO` we set minimum widths so that the window cannot be resized beyond a minimum height and width. This is done to prevent the WinUI elements from overlapping and getting cropped. If it is neither of these cases we send the message to the [`XamlBridge.MessageHandler`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/XamlBridge.cpp#L291-L301) which handles Destroy, Activation and Focus. If `WM_NCDESTROY` is received when the `XamlBridge` is `nullptr`, the window thread is terminated.
|
||||||
|
|
||||||
**Note:** `ContentDialog` in Xaml Islands requires manually settings a `XamlRoot`. This can generally be done by passing the XamlRoot from a component in the main window, such as the button used to open the dialog ([`sender.as<Button>().XamlRoot()`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/ShortcutControl.cpp#L31-L32)). [These docs]((https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)) have more details about this.
|
**Note:** `ContentDialog` in Xaml Islands requires manually settings a `XamlRoot`. This can generally be done by passing the XamlRoot from a component in the main window, such as the button used to open the dialog ([`sender.as<Button>().XamlRoot()`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/ShortcutControl.cpp#L31-L32)). [These docs]((https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)) have more details about this.
|
||||||
|
|
||||||
### Debugging exceptions in XAML Islands
|
### Debugging exceptions in XAML Islands
|
||||||
Sometimes if an exception occurs in XAML Islands, the stack trace may not always point to the correct code causing the exception and instead it will point to the Xaml Island message loop. In these cases the output window in VS will generally show the correct exception.
|
Sometimes if an exception occurs in XAML Islands, the stack trace may not always point to the correct code causing the exception and instead it will point to the Xaml Island message loop. In these cases the output window in VS will generally show the correct exception.
|
||||||
|
@ -33,7 +33,7 @@ The indexer plugin is used to search for files within the indexed locations of t
|
|||||||
### Score
|
### Score
|
||||||
Each of the indexer plugin results has a score set to 0 so they are present at the bottom of the list.
|
Each of the indexer plugin results has a score set to 0 so they are present at the bottom of the list.
|
||||||
|
|
||||||
[OLEDBCommand]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbcommand?view=dotnet-plat-ext-3.1
|
[OLEDBCommand]: https://learn.microsoft.com/dotnet/api/system.data.oledb.oledbcommand?view=dotnet-plat-ext-3.1
|
||||||
[OLEDBConnection]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbconnection?view=dotnet-plat-ext-3.1
|
[OLEDBConnection]: https://learn.microsoft.com/dotnet/api/system.data.oledb.oledbconnection?view=dotnet-plat-ext-3.1
|
||||||
[Contains]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-contains
|
[Contains]: https://learn.microsoft.com/windows/win32/search/-search-sql-contains
|
||||||
[Like]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-like
|
[Like]: https://learn.microsoft.com/windows/win32/search/-search-sql-like
|
||||||
|
@ -12,11 +12,11 @@ The registry plugin allows users to search the Windows registry.
|
|||||||
|
|
||||||
The registry contains all settings for the Windows operating system and many settings of the installed (Windows only) programs.
|
The registry contains all settings for the Windows operating system and many settings of the installed (Windows only) programs.
|
||||||
|
|
||||||
*Note: Linux and macOS program ports typical store the settings in it's own configuration files and not in the Windows registry.*
|
*Note: Linux and macOS program ports typical store the settings in their own configuration files and not in the Windows registry.*
|
||||||
|
|
||||||
For more information about the Windows registry, see [the official documentation](https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry).
|
For more information about the Windows registry, see [the official documentation](https://learn.microsoft.com/windows/win32/sysinfo/registry).
|
||||||
|
|
||||||
For advanced information about the Windows registry, see [Windows registry information for advanced users](https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/windows-registry-advanced-users).
|
For advanced information about the Windows registry, see [Windows registry information for advanced users](https://learn.microsoft.com/troubleshoot/windows-server/performance/windows-registry-advanced-users).
|
||||||
|
|
||||||
## Score
|
## Score
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ Once you've discussed your proposed feature/fix/etc. with a team member, and you
|
|||||||
|
|
||||||
1. Windows 10 April 2018 Update (version 1803) or newer
|
1. Windows 10 April 2018 Update (version 1803) or newer
|
||||||
2. Visual Studio Community/Professional/Enterprise 2022
|
2. Visual Studio Community/Professional/Enterprise 2022
|
||||||
3. Install the [required Windows Apps SDK workloads](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-2022-17-1-a%2Cvs-2022-17-1-b#required-workloads-and-components), the [Windows App SDK 1.0.3 C# Visual Studio 2022 extension](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads) and the [Windows Apps SDK 1.0.3 runtime](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#windows-app-sdk-10).
|
3. Install the [required Windows Apps SDK workloads](https://learn.microsoft.com/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-2022-17-1-a%2Cvs-2022-17-1-b#required-workloads-and-components), the [Windows App SDK 1.0.3 C# Visual Studio 2022 extension](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads) and the [Windows Apps SDK 1.0.3 runtime](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads#windows-app-sdk-10).
|
||||||
4. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
|
4. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
|
||||||
|
|
||||||
### Get Submodules to compile
|
### Get Submodules to compile
|
||||||
|
@ -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 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).
|
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://learn.microsoft.com/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).
|
||||||
|
|
||||||
#### [`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)
|
||||||
Contains code for initializing and managing the PowerToy modules. `PowertoyModule` is a RAII-style holder for the `PowertoyModuleIface` pointer, which we got by [invoking module DLL's `powertoy_create` function](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/powertoy_module.cpp#L13-L24).
|
Contains code for initializing and managing the PowerToy modules. `PowertoyModule` is a RAII-style holder for the `PowertoyModuleIface` pointer, which we got by [invoking module DLL's `powertoy_create` function](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/powertoy_module.cpp#L13-L24).
|
||||||
@ -17,7 +17,7 @@ Contains code for registering a Windows event hook through `SetWinEventHook`, th
|
|||||||
Contains code for managing the PowerToys tray icon and its menu commands. Note that `dispatch_run_on_main_ui_thread` is used to
|
Contains code for managing the PowerToys tray icon and its menu commands. Note that `dispatch_run_on_main_ui_thread` is used to
|
||||||
transfer received json message from the [Settings window](/doc/devdocs/settings.md) to the main thread, since we're communicating with it from [a dedicated thread](https://github.com/microsoft/PowerToys/blob/7357e40d3f54de51176efe54fda6d57028837b8c/src/runner/settings_window.cpp#L267-L271).
|
transfer received json message from the [Settings window](/doc/devdocs/settings.md) to the main thread, since we're communicating with it from [a dedicated thread](https://github.com/microsoft/PowerToys/blob/7357e40d3f54de51176efe54fda6d57028837b8c/src/runner/settings_window.cpp#L267-L271).
|
||||||
#### [`settings_window.cpp`](/src/runner/settings_window.cpp)
|
#### [`settings_window.cpp`](/src/runner/settings_window.cpp)
|
||||||
Contains code for starting the PowerToys settings window and communicating with it. Settings window is a separate process, so we're using [Windows pipes](https://docs.microsoft.com/en-us/windows/win32/ipc/pipes) as a transport for json messages.
|
Contains code for starting the PowerToys settings window and communicating with it. Settings window is a separate process, so we're using [Windows pipes](https://learn.microsoft.com/windows/win32/ipc/pipes) as a transport for json messages.
|
||||||
|
|
||||||
#### [`general_settings.cpp`](/src/runner/general_settings.cpp)
|
#### [`general_settings.cpp`](/src/runner/general_settings.cpp)
|
||||||
Contains code for loading, saving and applying the general settings.
|
Contains code for loading, saving and applying the general settings.
|
||||||
|
@ -14,4 +14,4 @@ The Settings.UI.Library project contains the data that is to be rendered by the
|
|||||||
#### [Settings Runner:](/src/settings-ui/Settings.UI)
|
#### [Settings Runner:](/src/settings-ui/Settings.UI)
|
||||||
The function of the settings runner project is to communicate all changes that the user makes in the user interface, to the runner so that it can be dispatched and reflected in all the modules.
|
The function of the settings runner project is to communicate all changes that the user makes in the user interface, to the runner so that it can be dispatched and reflected in all the modules.
|
||||||
|
|
||||||
[MVVM]: https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-and-mvvm
|
[MVVM]: https://learn.microsoft.com/windows/uwp/data-binding/data-binding-and-mvvm
|
||||||
|
@ -245,7 +245,7 @@ LExit:
|
|||||||
// Creates a Scheduled Task to run at logon for the current user.
|
// Creates a Scheduled Task to run at logon for the current user.
|
||||||
// The path of the executable to run should be passed as the CustomActionData (Value).
|
// The path of the executable to run should be passed as the CustomActionData (Value).
|
||||||
// Based on the Task Scheduler Logon Trigger Example:
|
// Based on the Task Scheduler Logon Trigger Example:
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/taskschd/logon-trigger-example--c---/
|
// https://learn.microsoft.com/windows/win32/taskschd/logon-trigger-example--c---/
|
||||||
UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
|
UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
@ -513,7 +513,7 @@ LExit:
|
|||||||
|
|
||||||
// Removes all Scheduled Tasks in the PowerToys folder and deletes the folder afterwards.
|
// Removes all Scheduled Tasks in the PowerToys folder and deletes the folder afterwards.
|
||||||
// Based on the Task Scheduler Displaying Task Names and State example:
|
// Based on the Task Scheduler Displaying Task Names and State example:
|
||||||
// https://docs.microsoft.com/en-us/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
|
// https://learn.microsoft.com/windows/desktop/TaskSchd/displaying-task-names-and-state--c---/
|
||||||
UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
|
UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
@ -20,6 +20,6 @@ To capture a trace for the PowerToys provider, run the following:
|
|||||||
Open the trace.etl file in WPA.
|
Open the trace.etl file in WPA.
|
||||||
|
|
||||||
## Additional Resources
|
## Additional Resources
|
||||||
[Tracelogging on MSDN](https://docs.microsoft.com/en-us/windows/win32/tracelogging/trace-logging-portal)
|
[Tracelogging on Microsoft Learn](https://learn.microsoft.com/windows/win32/tracelogging/trace-logging-portal)
|
||||||
|
|
||||||
[Recording and Viewing Events](https://docs.microsoft.com/en-us/windows/win32/tracelogging/tracelogging-record-and-display-tracelogging-events)
|
[Recording and Viewing Events](https://learn.microsoft.com/windows/win32/tracelogging/tracelogging-record-and-display-tracelogging-events)
|
||||||
|
@ -25,7 +25,7 @@ using namespace System;
|
|||||||
using namespace System::Runtime::InteropServices;
|
using namespace System::Runtime::InteropServices;
|
||||||
using System::Collections::Generic::List;
|
using System::Collections::Generic::List;
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
|
// https://learn.microsoft.com/cpp/dotnet/how-to-wrap-native-class-for-use-by-csharp?view=vs-2019
|
||||||
namespace interop
|
namespace interop
|
||||||
{
|
{
|
||||||
public
|
public
|
||||||
|
@ -77,7 +77,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::end()
|
|||||||
|
|
||||||
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::send_pipe_message(std::wstring message)
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::send_pipe_message(std::wstring message)
|
||||||
{
|
{
|
||||||
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client
|
// Adapted from https://learn.microsoft.com/windows/win32/ipc/named-pipe-client
|
||||||
HANDLE output_pipe_handle;
|
HANDLE output_pipe_handle;
|
||||||
const wchar_t* message_send = message.c_str();
|
const wchar_t* message_send = message.c_str();
|
||||||
BOOL fSuccess = FALSE;
|
BOOL fSuccess = FALSE;
|
||||||
@ -161,7 +161,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::consume_output_queue_thread
|
|||||||
|
|
||||||
BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, PSID* ppsid)
|
BOOL TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::GetLogonSID(HANDLE hToken, PSID* ppsid)
|
||||||
{
|
{
|
||||||
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
// From https://learn.microsoft.com/previous-versions/aa446670(v=vs.85)
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex;
|
||||||
DWORD dwLength = 0;
|
DWORD dwLength = 0;
|
||||||
@ -240,7 +240,7 @@ Cleanup:
|
|||||||
|
|
||||||
VOID TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::FreeLogonSID(PSID* ppsid)
|
VOID TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::FreeLogonSID(PSID* ppsid)
|
||||||
{
|
{
|
||||||
// From https://docs.microsoft.com/en-us/previous-versions/aa446670(v=vs.85)
|
// From https://learn.microsoft.com/previous-versions/aa446670(v=vs.85)
|
||||||
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
HeapFree(GetProcessHeap(), 0, (LPVOID)*ppsid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::handle_pipe_connection(HAND
|
|||||||
|
|
||||||
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start_named_pipe_server(HANDLE token)
|
void TwoWayPipeMessageIPC::TwoWayPipeMessageIPCImpl::start_named_pipe_server(HANDLE token)
|
||||||
{
|
{
|
||||||
// Adapted from https://docs.microsoft.com/en-us/windows/win32/ipc/multithreaded-pipe-server
|
// Adapted from https://learn.microsoft.com/windows/win32/ipc/multithreaded-pipe-server
|
||||||
const wchar_t* pipe_name = input_pipe_name.c_str();
|
const wchar_t* pipe_name = input_pipe_name.c_str();
|
||||||
BOOL connected = FALSE;
|
BOOL connected = FALSE;
|
||||||
HANDLE connect_pipe_handle = INVALID_HANDLE_VALUE;
|
HANDLE connect_pipe_handle = INVALID_HANDLE_VALUE;
|
||||||
|
@ -244,7 +244,7 @@ void notifications::show_toast_with_activations(std::wstring message,
|
|||||||
toast_params params)
|
toast_params params)
|
||||||
{
|
{
|
||||||
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
||||||
// https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
// https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
||||||
|
|
||||||
std::wstring toast_xml;
|
std::wstring toast_xml;
|
||||||
toast_xml.reserve(2048);
|
toast_xml.reserve(2048);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- See https://docs.microsoft.com/en-us/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<CsWinRTIncludes>PowerToys.MeasureToolCore</CsWinRTIncludes>
|
<CsWinRTIncludes>PowerToys.MeasureToolCore</CsWinRTIncludes>
|
||||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
|
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
|
||||||
|
|
||||||
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
Makes the application long-path aware. See https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||||
<!--
|
<!--
|
||||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
<windowsSettings>
|
<windowsSettings>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<!--Per documentation: https://docs.microsoft.com/dotnet/core/compatibility/windows-forms/5.0/automatically-infer-winexe-output-type#outputtype-set-to-winexe-for-wpf-and-winforms-apps -->
|
<!--Per documentation: https://learn.microsoft.com/dotnet/core/compatibility/windows-forms/5.0/automatically-infer-winexe-output-type#outputtype-set-to-winexe-for-wpf-and-winforms-apps -->
|
||||||
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
|
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
|
||||||
<AssemblyName>PowerToys.Awake</AssemblyName>
|
<AssemblyName>PowerToys.Awake</AssemblyName>
|
||||||
<Version>$(Version).0</Version>
|
<Version>$(Version).0</Version>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Awake.Core.Models
|
namespace Awake.Core.Models
|
||||||
{
|
{
|
||||||
// See: https://docs.microsoft.com/windows/console/handlerroutine
|
// See: https://learn.microsoft.com/windows/console/handlerroutine
|
||||||
public enum ControlType
|
public enum ControlType
|
||||||
{
|
{
|
||||||
CTRL_C_EVENT = 0,
|
CTRL_C_EVENT = 0,
|
||||||
|
@ -225,7 +225,7 @@ namespace ColorPicker.Helpers
|
|||||||
{
|
{
|
||||||
// If escape key is blocked it means a submenu is open.
|
// If escape key is blocked it means a submenu is open.
|
||||||
// Send the escape key to the Window to close that submenu.
|
// Send the escape key to the Window to close that submenu.
|
||||||
// Description for LPARAM in https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-keyup#parameters
|
// Description for LPARAM in https://learn.microsoft.com/windows/win32/inputdev/wm-keyup#parameters
|
||||||
// It's basically some modifiers + scancode for escape (1) + number of repetitions (1)
|
// It's basically some modifiers + scancode for escape (1) + number of repetitions (1)
|
||||||
handled = true;
|
handled = true;
|
||||||
handled &= NativeMethods.PostMessage(_hwndSource.Handle, NativeMethods.WM_KEYDOWN, (IntPtr)NativeMethods.VK_ESCAPE, (IntPtr)0x00010001);
|
handled &= NativeMethods.PostMessage(_hwndSource.Handle, NativeMethods.WM_KEYDOWN, (IntPtr)NativeMethods.VK_ESCAPE, (IntPtr)0x00010001);
|
||||||
|
@ -11,7 +11,7 @@ using System.Windows.Interop;
|
|||||||
|
|
||||||
namespace ColorPicker
|
namespace ColorPicker
|
||||||
{
|
{
|
||||||
// https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1060?view=vs-2019
|
// https://learn.microsoft.com/visualstudio/code-quality/ca1060?view=vs-2019
|
||||||
// will have to rename
|
// will have to rename
|
||||||
public static class NativeMethods
|
public static class NativeMethods
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace ImageResizer.Models
|
|||||||
private readonly string _destinationDirectory;
|
private readonly string _destinationDirectory;
|
||||||
private readonly Settings _settings;
|
private readonly Settings _settings;
|
||||||
|
|
||||||
// Filenames to avoid according to https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names
|
// Filenames to avoid according to https://learn.microsoft.com/windows/win32/fileio/naming-a-file#file-and-directory-names
|
||||||
private static readonly string[] _avoidFilenames =
|
private static readonly string[] _avoidFilenames =
|
||||||
{
|
{
|
||||||
"CON", "PRN", "AUX", "NUL",
|
"CON", "PRN", "AUX", "NUL",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</application>
|
</application>
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<application>
|
<application>
|
||||||
<!-- Required for C++ XAML Islands. More details at https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands-cpp#create-a-desktop-application-project -->
|
<!-- Required for C++ XAML Islands. More details at https://learn.microsoft.com/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands-cpp#create-a-desktop-application-project -->
|
||||||
<maxversiontested Id="10.0.19041.0"/>
|
<maxversiontested Id="10.0.19041.0"/>
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
|
@ -80,7 +80,7 @@ void KeyDropDownControl::SetDefaultProperties(bool isShortcut, bool renderDisabl
|
|||||||
// Attach flyout to the drop down
|
// Attach flyout to the drop down
|
||||||
warningFlyout.as<Flyout>().Content(warningMessage.as<TextBlock>());
|
warningFlyout.as<Flyout>().Content(warningMessage.as<TextBlock>());
|
||||||
|
|
||||||
// Enable narrator for Content of FlyoutPresenter. For details https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.flyout?view=winrt-19041#accessibility
|
// Enable narrator for Content of FlyoutPresenter. For details https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.flyout?view=winrt-19041#accessibility
|
||||||
Style style = Style(winrt::xaml_typename<FlyoutPresenter>());
|
Style style = Style(winrt::xaml_typename<FlyoutPresenter>());
|
||||||
style.Setters().Append(Setter(Windows::UI::Xaml::Controls::Control::IsTabStopProperty(), winrt::box_value(true)));
|
style.Setters().Append(Setter(Windows::UI::Xaml::Controls::Control::IsTabStopProperty(), winrt::box_value(true)));
|
||||||
style.Setters().Append(Setter(Windows::UI::Xaml::Controls::Control::TabNavigationProperty(), winrt::box_value(Windows::UI::Xaml::Input::KeyboardNavigationMode::Cycle)));
|
style.Setters().Append(Setter(Windows::UI::Xaml::Controls::Control::TabNavigationProperty(), winrt::box_value(Windows::UI::Xaml::Input::KeyboardNavigationMode::Cycle)));
|
||||||
|
@ -291,7 +291,7 @@ void ShortcutControl::CreateDetectShortcutWindow(winrt::Windows::Foundation::IIn
|
|||||||
// ContentDialog for detecting shortcuts. This is the parent UI element.
|
// ContentDialog for detecting shortcuts. This is the parent UI element.
|
||||||
ContentDialog detectShortcutBox;
|
ContentDialog detectShortcutBox;
|
||||||
|
|
||||||
// ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
|
// ContentDialog requires manually setting the XamlRoot (https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
|
||||||
detectShortcutBox.XamlRoot(xamlRoot);
|
detectShortcutBox.XamlRoot(xamlRoot);
|
||||||
detectShortcutBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPESHORTCUT_TITLE)));
|
detectShortcutBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPESHORTCUT_TITLE)));
|
||||||
detectShortcutBox.IsPrimaryButtonEnabled(false);
|
detectShortcutBox.IsPrimaryButtonEnabled(false);
|
||||||
|
@ -221,7 +221,7 @@ void SingleKeyRemapControl::createDetectKeyWindow(winrt::Windows::Foundation::II
|
|||||||
// ContentDialog for detecting remap key. This is the parent UI element.
|
// ContentDialog for detecting remap key. This is the parent UI element.
|
||||||
ContentDialog detectRemapKeyBox;
|
ContentDialog detectRemapKeyBox;
|
||||||
|
|
||||||
// ContentDialog requires manually setting the XamlRoot (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
|
// ContentDialog requires manually setting the XamlRoot (https://learn.microsoft.com/uwp/api/windows.ui.xaml.controls.contentdialog#contentdialog-in-appwindow-or-xaml-islands)
|
||||||
detectRemapKeyBox.XamlRoot(xamlRoot);
|
detectRemapKeyBox.XamlRoot(xamlRoot);
|
||||||
detectRemapKeyBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPEKEY_TITLE)));
|
detectRemapKeyBox.Title(box_value(GET_RESOURCE_STRING(IDS_TYPEKEY_TITLE)));
|
||||||
detectRemapKeyBox.IsPrimaryButtonEnabled(false);
|
detectRemapKeyBox.IsPrimaryButtonEnabled(false);
|
||||||
|
@ -9,7 +9,7 @@ void MockedInput::SetHookProc(std::function<intptr_t(LowlevelKeyboardEvent*)> ho
|
|||||||
hookProc = hookProcedure;
|
hookProc = hookProcedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to simulate keyboard input - arguments and return value based on SendInput function (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput)
|
// Function to simulate keyboard input - arguments and return value based on SendInput function (https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput)
|
||||||
UINT MockedInput::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
|
UINT MockedInput::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
|
||||||
{
|
{
|
||||||
// Iterate over inputs
|
// Iterate over inputs
|
||||||
@ -17,7 +17,7 @@ UINT MockedInput::SendVirtualInput(UINT cInputs, LPINPUT pInputs, int cbSize)
|
|||||||
{
|
{
|
||||||
LowlevelKeyboardEvent keyEvent;
|
LowlevelKeyboardEvent keyEvent;
|
||||||
|
|
||||||
// Distinguish between key and sys key by checking if the key is either F10 (for syskeydown) or if the key message is sent while Alt is held down. SYSKEY messages are also sent if there is no window in focus, but that has not been mocked since it would require many changes. More details on key messages at https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-syskeydown
|
// Distinguish between key and sys key by checking if the key is either F10 (for syskeydown) or if the key message is sent while Alt is held down. SYSKEY messages are also sent if there is no window in focus, but that has not been mocked since it would require many changes. More details on key messages at https://learn.microsoft.com/windows/win32/inputdev/wm-syskeydown
|
||||||
if (pInputs[i].ki.dwFlags & KEYEVENTF_KEYUP)
|
if (pInputs[i].ki.dwFlags & KEYEVENTF_KEYUP)
|
||||||
{
|
{
|
||||||
if (keyboardState[VK_MENU] == true)
|
if (keyboardState[VK_MENU] == true)
|
||||||
|
@ -617,7 +617,7 @@ bool IgnoreKeyCode(DWORD key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As per docs: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
// As per docs: https://learn.microsoft.com/windows/win32/inputdev/virtual-key-codes
|
||||||
// Undefined keys
|
// Undefined keys
|
||||||
bool isUndefined = equals(key, 0x07) || in_range(key, 0x0E, 0x0F) || in_range(key, 0x3A, 0x40);
|
bool isUndefined = equals(key, 0x07) || in_range(key, 0x0E, 0x0F) || in_range(key, 0x3A, 0x40);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
|
|
||||||
if (!displayHiddenFiles)
|
if (!displayHiddenFiles)
|
||||||
{
|
{
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/search/all-bitwise
|
// https://learn.microsoft.com/windows/win32/search/all-bitwise
|
||||||
queryHelper.QueryWhereRestrictions += " AND System.FileAttributes <> SOME BITWISE " + _fileAttributeHidden;
|
queryHelper.QueryWhereRestrictions += " AND System.FileAttributes <> SOME BITWISE " + _fileAttributeHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
var xmlRoot = xmlDoc.DocumentElement;
|
var xmlRoot = xmlDoc.DocumentElement;
|
||||||
var namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);
|
var namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);
|
||||||
namespaceManager.AddNamespace("uap10", "http://schemas.microsoft.com/appx/manifest/uap/windows10/10");
|
namespaceManager.AddNamespace("uap10", "http://schemas.microsoft.com/appx/manifest/uap/windows10/10");
|
||||||
var trustLevelNode = xmlRoot.SelectSingleNode("//*[local-name()='Application' and @uap10:TrustLevel]", namespaceManager); // According to https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/grant-identity-to-nonpackaged-apps#create-a-package-manifest-for-the-sparse-package and https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-application#attributes
|
var trustLevelNode = xmlRoot.SelectSingleNode("//*[local-name()='Application' and @uap10:TrustLevel]", namespaceManager); // According to https://learn.microsoft.com/windows/apps/desktop/modernize/grant-identity-to-nonpackaged-apps#create-a-package-manifest-for-the-sparse-package and https://learn.microsoft.com/uwp/schemas/appxpackage/uapmanifestschema/element-application#attributes
|
||||||
|
|
||||||
if (trustLevelNode?.Attributes["uap10:TrustLevel"]?.Value == "mediumIL")
|
if (trustLevelNode?.Attributes["uap10:TrustLevel"]?.Value == "mediumIL")
|
||||||
{
|
{
|
||||||
@ -414,7 +414,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
LogoPathFromUri(logoUri, theme);
|
LogoPathFromUri(logoUri, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale factors on win10: https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets#asset-size-tables,
|
// scale factors on win10: https://learn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets#asset-size-tables,
|
||||||
private static readonly Dictionary<PackageVersion, List<int>> _scaleFactors = new Dictionary<PackageVersion, List<int>>
|
private static readonly Dictionary<PackageVersion, List<int>> _scaleFactors = new Dictionary<PackageVersion, List<int>>
|
||||||
{
|
{
|
||||||
{ PackageVersion.Windows10, new List<int> { 100, 125, 150, 200, 400 } },
|
{ PackageVersion.Windows10, new List<int> { 100, 125, 150, 200, 400 } },
|
||||||
|
@ -711,7 +711,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
|
|
||||||
foreach (var childDirectory in Directory.EnumerateDirectories(currentDirectory, "*", new EnumerationOptions()
|
foreach (var childDirectory in Directory.EnumerateDirectories(currentDirectory, "*", new EnumerationOptions()
|
||||||
{
|
{
|
||||||
// https://docs.microsoft.com/en-us/dotnet/api/system.io.enumerationoptions?view=net-6.0
|
// https://learn.microsoft.com/dotnet/api/system.io.enumerationoptions?view=net-6.0
|
||||||
// Exclude directories with the Reparse Point file attribute, to avoid loops due to symbolic links / directory junction / mount points.
|
// Exclude directories with the Reparse Point file attribute, to avoid loops due to symbolic links / directory junction / mount points.
|
||||||
AttributesToSkip = FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReparsePoint,
|
AttributesToSkip = FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReparsePoint,
|
||||||
RecurseSubdirectories = false,
|
RecurseSubdirectories = false,
|
||||||
|
@ -202,7 +202,7 @@ namespace Microsoft.PowerToys.Run.Plugin.History
|
|||||||
|
|
||||||
menuItems.Add(new ContextMenuResult
|
menuItems.Add(new ContextMenuResult
|
||||||
{
|
{
|
||||||
// https://docs.microsoft.com/en-us/windows/apps/design/style/segoe-ui-symbol-font
|
// https://learn.microsoft.com/windows/apps/design/style/segoe-ui-symbol-font
|
||||||
FontFamily = "Segoe MDL2 Assets",
|
FontFamily = "Segoe MDL2 Assets",
|
||||||
Glyph = "\xF739", // ECC9 => Symbol: RemoveFrom, or F739 => SetHistoryStatus2
|
Glyph = "\xF739", // ECC9 => Symbol: RemoveFrom, or F739 => SetHistoryStatus2
|
||||||
Title = $"Remove this from history",
|
Title = $"Remove this from history",
|
||||||
|
@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||||
/// <para>Symbols taken from <see href="https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The result for the context menu entires</param>
|
/// <param name="result">The result for the context menu entires</param>
|
||||||
/// <param name="assemblyName">The name of the this assembly</param>
|
/// <param name="assemblyName">The name of the this assembly</param>
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="PluginDescription" xml:space="preserve">
|
<data name="PluginDescription" xml:space="preserve">
|
||||||
<value>Navigates inside the Windows Registry.</value>
|
<value>Navigates inside the Windows Registry.</value>
|
||||||
<comment>"this built into Windows the OS. translate accordingly, https://docs.microsoft.com/de-de/troubleshoot/windows-server/performance/windows-registry-advanced-users is an example of it translated in German"</comment>
|
<comment>"this built into Windows the OS. translate accordingly, https://learn.microsoft.com/troubleshoot/windows-server/performance/windows-registry-advanced-users is an example of it translated in German"</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="CopyKeyNamePath" xml:space="preserve">
|
<data name="CopyKeyNamePath" xml:space="preserve">
|
||||||
<value>Copy key name (path)</value>
|
<value>Copy key name (path)</value>
|
||||||
@ -164,11 +164,11 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="Type" xml:space="preserve">
|
<data name="Type" xml:space="preserve">
|
||||||
<value>Type:</value>
|
<value>Type:</value>
|
||||||
<comment>See https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types for proper context of how to translate 'type'</comment>
|
<comment>See https://learn.microsoft.com/windows/win32/sysinfo/registry-value-types for proper context of how to translate 'type'</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="Value" xml:space="preserve">
|
<data name="Value" xml:space="preserve">
|
||||||
<value>Value:</value>
|
<value>Value:</value>
|
||||||
<comment>See https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types for proper context of how to translate 'value'</comment>
|
<comment>See https://learn.microsoft.com/windows/win32/sysinfo/registry-value-types for proper context of how to translate 'value'</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="RegistryValueKindNone" xml:space="preserve">
|
<data name="RegistryValueKindNone" xml:space="preserve">
|
||||||
<value>No data type</value>
|
<value>No data type</value>
|
||||||
|
@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
|
|||||||
/// <param name="targetFormat">Type of format</param>
|
/// <param name="targetFormat">Type of format</param>
|
||||||
/// <param name="timeLong">Show date with weekday and name of month (long format)</param>
|
/// <param name="timeLong">Show date with weekday and name of month (long format)</param>
|
||||||
/// <param name="dateLong">Show time with seconds (long format)</param>
|
/// <param name="dateLong">Show time with seconds (long format)</param>
|
||||||
/// <returns>String that identifies the time/date format (<see href="https://docs.microsoft.com/en-us/dotnet/api/system.datetime.tostring"/>)</returns>
|
/// <returns>String that identifies the time/date format (<see href="https://learn.microsoft.com/dotnet/api/system.datetime.tostring"/>)</returns>
|
||||||
internal static string GetStringFormat(FormatStringType targetFormat, bool timeLong, bool dateLong)
|
internal static string GetStringFormat(FormatStringType targetFormat, bool timeLong, bool dateLong)
|
||||||
{
|
{
|
||||||
switch (targetFormat)
|
switch (targetFormat)
|
||||||
|
@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeZone.Helper
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||||
/// <para>Symbols taken from <see href="https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The result for the context menu entires</param>
|
/// <param name="result">The result for the context menu entires</param>
|
||||||
/// <param name="assemblyName">The name of the this assembly</param>
|
/// <param name="assemblyName">The name of the this assembly</param>
|
||||||
|
@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||||
/// <para>Symbols taken from <see href="https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The result for the context menu entires</param>
|
/// <param name="result">The result for the context menu entires</param>
|
||||||
/// <param name="assemblyName">The name of the this assembly</param>
|
/// <param name="assemblyName">The name of the this assembly</param>
|
||||||
|
@ -100,7 +100,7 @@ namespace PowerLauncher.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey
|
// https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-registerhotkey
|
||||||
internal enum HOTKEY_MODIFIERS : uint
|
internal enum HOTKEY_MODIFIERS : uint
|
||||||
{
|
{
|
||||||
ALT = 0x0001,
|
ALT = 0x0001,
|
||||||
@ -111,7 +111,7 @@ namespace PowerLauncher.Helper
|
|||||||
CHECK_FLAGS = 0x000F, // modifiers to compare between keys.
|
CHECK_FLAGS = 0x000F, // modifiers to compare between keys.
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow
|
// https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-showwindow
|
||||||
internal enum SW : int
|
internal enum SW : int
|
||||||
{
|
{
|
||||||
HIDE = 0x0000,
|
HIDE = 0x0000,
|
||||||
|
@ -20,7 +20,7 @@ namespace PowerLauncher
|
|||||||
|
|
||||||
private ToolTip _previouslyOpenedToolTip;
|
private ToolTip _previouslyOpenedToolTip;
|
||||||
|
|
||||||
// From https://docs.microsoft.com/en-us/dotnet/desktop/wpf/data/how-to-find-datatemplate-generated-elements
|
// From https://learn.microsoft.com/dotnet/desktop/wpf/data/how-to-find-datatemplate-generated-elements
|
||||||
private TypeChildItem FindVisualChild<TypeChildItem>(DependencyObject obj)
|
private TypeChildItem FindVisualChild<TypeChildItem>(DependencyObject obj)
|
||||||
where TypeChildItem : DependencyObject
|
where TypeChildItem : DependencyObject
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ namespace Wox.Infrastructure.Exception
|
|||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
// GlobalAssemblyCache - .NET Core and .NET 5 and later: false in all cases.
|
// GlobalAssemblyCache - .NET Core and .NET 5 and later: false in all cases.
|
||||||
// Source https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.globalassemblycache?view=net-6.0
|
// Source https://learn.microsoft.com/dotnet/api/system.reflection.assembly.globalassemblycache?view=net-6.0
|
||||||
foreach (var ass in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (var ass in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
{
|
{
|
||||||
sb.Append("* ");
|
sb.Append("* ");
|
||||||
|
@ -8,7 +8,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Interop
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Virtual Desktop Manager class
|
/// Virtual Desktop Manager class
|
||||||
/// Code used from <see href="https://docs.microsoft.com/en-us/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10"./>
|
/// Code used from <see href="https://learn.microsoft.com/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10"./>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ComImport]
|
[ComImport]
|
||||||
[Guid("aa509086-5ca9-4c25-8f95-589d3c07b48a")]
|
[Guid("aa509086-5ca9-4c25-8f95-589d3c07b48a")]
|
||||||
|
@ -9,7 +9,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Interop
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for accessing Virtual Desktop Manager.
|
/// Interface for accessing Virtual Desktop Manager.
|
||||||
/// Code used from <see href="https://docs.microsoft.com/en-us/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10"./>
|
/// Code used from <see href="https://learn.microsoft.com/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10"./>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ComImport]
|
[ComImport]
|
||||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
@ -22,8 +22,8 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
|
|||||||
/// To use this helper you have to create an instance of it and access the method via the helper instance.
|
/// To use this helper you have to create an instance of it and access the method via the helper instance.
|
||||||
/// We are only allowed to use public documented com interfaces.
|
/// We are only allowed to use public documented com interfaces.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <SeeAlso href="https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ivirtualdesktopmanager">Documentation of IVirtualDesktopManager interface</SeeAlso>
|
/// <SeeAlso href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/nn-shobjidl_core-ivirtualdesktopmanager">Documentation of IVirtualDesktopManager interface</SeeAlso>
|
||||||
/// <SeeAlso href="https://docs.microsoft.com/en-us/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10">CSharp example code for IVirtualDesktopManager</SeeAlso>
|
/// <SeeAlso href="https://learn.microsoft.com/archive/blogs/winsdk/virtual-desktop-switching-in-windows-10">CSharp example code for IVirtualDesktopManager</SeeAlso>
|
||||||
public class VirtualDesktopHelper
|
public class VirtualDesktopHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -205,7 +205,7 @@ namespace Wox.Plugin.Common.Win32
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// <see href="https://docs.microsoft.com/windows/win32/api/winnt/ne-winnt-firmware_type">see docs.microsoft.com</see>
|
/// <see href="https://learn.microsoft.com/windows/win32/api/winnt/ne-winnt-firmware_type">see learn.microsoft.com</see>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public enum FirmwareType
|
public enum FirmwareType
|
||||||
{
|
{
|
||||||
@ -216,7 +216,7 @@ namespace Wox.Plugin.Common.Win32
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see href="https://docs.microsoft.com/windows/win32/stg/stgm-constants">see all STGM values</see>
|
/// <see href="https://learn.microsoft.com/windows/win32/stg/stgm-constants">see all STGM values</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum STGM : long
|
public enum STGM : long
|
||||||
|
@ -1123,7 +1123,7 @@ DWORD WINAPI CPowerRenameManager::s_regexWorkerThread(_In_ void* pv)
|
|||||||
spItem->GetPath(&path);
|
spItem->GetPath(&path);
|
||||||
|
|
||||||
// Following characters cannot be used for file names.
|
// Following characters cannot be used for file names.
|
||||||
// Ref https://docs.microsoft.com/windows/win32/fileio/naming-a-file#naming-conventions
|
// Ref https://learn.microsoft.com/windows/win32/fileio/naming-a-file#naming-conventions
|
||||||
if (newNameToUseWstr.contains('<') ||
|
if (newNameToUseWstr.contains('<') ||
|
||||||
newNameToUseWstr.contains('>') ||
|
newNameToUseWstr.contains('>') ||
|
||||||
newNameToUseWstr.contains(':') ||
|
newNameToUseWstr.contains(':') ||
|
||||||
@ -1137,7 +1137,7 @@ DWORD WINAPI CPowerRenameManager::s_regexWorkerThread(_In_ void* pv)
|
|||||||
spItem->PutStatus(PowerRenameItemRenameStatus::ItemNameInvalidChar);
|
spItem->PutStatus(PowerRenameItemRenameStatus::ItemNameInvalidChar);
|
||||||
}
|
}
|
||||||
// Max file path is 260 and max folder path is 247.
|
// Max file path is 260 and max folder path is 247.
|
||||||
// Ref https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
|
// Ref https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
|
||||||
else if ((isFolder && lstrlen(path) + (lstrlen(newNameToUse) - lstrlen(originalName)) > 247) ||
|
else if ((isFolder && lstrlen(path) + (lstrlen(newNameToUse) - lstrlen(originalName)) > 247) ||
|
||||||
lstrlen(path) + (lstrlen(newNameToUse) - lstrlen(originalName)) > 260)
|
lstrlen(path) + (lstrlen(newNameToUse) - lstrlen(originalName)) > 260)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
|||||||
};
|
};
|
||||||
|
|
||||||
// WebView2.NavigateToString() limitation
|
// WebView2.NavigateToString() limitation
|
||||||
// See https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
// See https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
||||||
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
||||||
if (markdownHTML.Length > 1_500_000)
|
if (markdownHTML.Length > 1_500_000)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ FileExplorerPreviewSettings(
|
|||||||
|
|
||||||
### MSI (Recommended)
|
### MSI (Recommended)
|
||||||
|
|
||||||
To add a new Previewer update the `Product.wxs` file in `PowerToysSetup` similar to existing Previewer to register the Preview Handler. More details about registration of Preview Handlers can be [found here.](https://docs.microsoft.com/en-us/windows/win32/shell/how-to-register-a-preview-handler)
|
To add a new Previewer update the `Product.wxs` file in `PowerToysSetup` similar to existing Previewer to register the Preview Handler. More details about registration of Preview Handlers can be [found here.](https://learn.microsoft.com/windows/win32/shell/how-to-register-a-preview-handler)
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<Component Id="Module_PowerPreview" Guid="FF1700D5-1B07-4E07-9A62-4D206645EEA9" Win64="yes">
|
<Component Id="Module_PowerPreview" Guid="FF1700D5-1B07-4E07-9A62-4D206645EEA9" Win64="yes">
|
||||||
@ -127,7 +127,7 @@ To add a new Previewer update the `Product.wxs` file in `PowerToysSetup` similar
|
|||||||
**[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.**
|
**[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.**
|
||||||
#### Registering Preview Handler
|
#### Registering Preview Handler
|
||||||
1. Restart Visual studio as administrator.
|
1. Restart Visual studio as administrator.
|
||||||
2. Sign `XYZPreviewHandler` and it's dependencies. To sign an assembly in VS, follow steps given [here](https://docs.microsoft.com/en-us/dotnet/standard/assembly/sign-strong-name#create-and-sign-an-assembly-with-a-strong-name-by-using-visual-studio).
|
2. Sign `XYZPreviewHandler` and it's dependencies. To sign an assembly in VS, follow steps given [here](https://learn.microsoft.com/dotnet/standard/assembly/sign-strong-name#create-and-sign-an-assembly-with-a-strong-name-by-using-visual-studio).
|
||||||
3. Build `XYZPreviewHandler` project.
|
3. Build `XYZPreviewHandler` project.
|
||||||
4. Open developer command prompt from `Tools > Command Line > Developer Command Prompt`.
|
4. Open developer command prompt from `Tools > Command Line > Developer Command Prompt`.
|
||||||
5. Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC).
|
5. Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC).
|
||||||
|
@ -215,7 +215,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg
|
|||||||
_browser.CoreWebView2.WebResourceRequested += CoreWebView2_BlockExternalResources;
|
_browser.CoreWebView2.WebResourceRequested += CoreWebView2_BlockExternalResources;
|
||||||
|
|
||||||
// WebView2.NavigateToString() limitation
|
// WebView2.NavigateToString() limitation
|
||||||
// See https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
// See https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
||||||
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
||||||
if (svgData.Length > 1_500_000)
|
if (svgData.Length > 1_500_000)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Svg
|
|||||||
};
|
};
|
||||||
|
|
||||||
// WebView2.NavigateToString() limitation
|
// WebView2.NavigateToString() limitation
|
||||||
// See https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
// See https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2.navigatetostring?view=webview2-dotnet-1.0.864.35#remarks
|
||||||
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
// While testing the limit, it turned out it is ~1.5MB, so to be on a safe side we go for 1.5m bytes
|
||||||
if (wrappedContent.Length > 1_500_000)
|
if (wrappedContent.Length > 1_500_000)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace PreviewHandlerCommonUnitTests
|
|||||||
{
|
{
|
||||||
public static class NativeMethods
|
public static class NativeMethods
|
||||||
{
|
{
|
||||||
// Gets the ancestor window: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getancestor
|
// Gets the ancestor window: https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-getancestor
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
internal static extern IntPtr GetAncestor(IntPtr hWnd, uint gaFlags);
|
internal static extern IntPtr GetAncestor(IntPtr hWnd, uint gaFlags);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ namespace Common.Utilities
|
|||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
System.Runtime.InteropServices.ComTypes.STATSTG stat;
|
System.Runtime.InteropServices.ComTypes.STATSTG stat;
|
||||||
|
|
||||||
// Stat called with STATFLAG_NONAME. The pwcsName is not required more details https://docs.microsoft.com/en-us/windows/win32/api/wtypes/ne-wtypes-statflag
|
// Stat called with STATFLAG_NONAME. The pwcsName is not required more details https://learn.microsoft.com/windows/win32/api/wtypes/ne-wtypes-statflag
|
||||||
_stream.Stat(out stat, 1); // STATFLAG_NONAME
|
_stream.Stat(out stat, 1); // STATFLAG_NONAME
|
||||||
|
|
||||||
return stat.cbSize;
|
return stat.cbSize;
|
||||||
@ -153,7 +153,7 @@ namespace Common.Utilities
|
|||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
int dwOrigin;
|
int dwOrigin;
|
||||||
|
|
||||||
// Maps the SeekOrigin with dworigin more details: https://docs.microsoft.com/en-us/windows/win32/api/objidl/ne-objidl-stream_seek
|
// Maps the SeekOrigin with dworigin more details: https://learn.microsoft.com/windows/win32/api/objidl/ne-objidl-stream_seek
|
||||||
switch (origin)
|
switch (origin)
|
||||||
{
|
{
|
||||||
case SeekOrigin.Begin:
|
case SeekOrigin.Begin:
|
||||||
|
@ -20,7 +20,7 @@ namespace Common.ComInterlop
|
|||||||
/// Initializes a handler with a stream.
|
/// Initializes a handler with a stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pstream">A pointer to an <see cref="IStream" /> interface that represents the stream source.</param>
|
/// <param name="pstream">A pointer to an <see cref="IStream" /> interface that represents the stream source.</param>
|
||||||
/// <param name="grfMode">One of the <see href="https://docs.microsoft.com/en-us/windows/win32/stg/stgm-constants" >STGM</see> values that indicates the access mode for <paramref name="pstream"/>.</param>
|
/// <param name="grfMode">One of the <see href="https://learn.microsoft.com/windows/win32/stg/stgm-constants" >STGM</see> values that indicates the access mode for <paramref name="pstream"/>.</param>
|
||||||
void Initialize(IStream pstream, uint grfMode);
|
void Initialize(IStream pstream, uint grfMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace Common.ComInterlop
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of the keyboard shortcuts for the preview host.
|
/// Gets a list of the keyboard shortcuts for the preview host.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pinfo">A pointer to a <see href="https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ns-shobjidl_core-previewhandlerframeinfo">PREVIEWHANDLERFRAMEINFO</see> structure
|
/// <param name="pinfo">A pointer to a <see href="https://learn.microsoft.com/windows/win32/api/shobjidl_core/ns-shobjidl_core-previewhandlerframeinfo">PREVIEWHANDLERFRAMEINFO</see> structure
|
||||||
/// that receives accelerator table information.</param>
|
/// that receives accelerator table information.</param>
|
||||||
void GetWindowContext(IntPtr pinfo);
|
void GetWindowContext(IntPtr pinfo);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace Common
|
|||||||
{
|
{
|
||||||
// Gets the handle of the control to create the control on the VI thread. Invoking the Control.Handle get accessor forces the creation of the underlying window for the control.
|
// Gets the handle of the control to create the control on the VI thread. Invoking the Control.Handle get accessor forces the creation of the underlying window for the control.
|
||||||
// This is important, because the thread that instantiates the preview handler component and calls its constructor is a single-threaded apartment (STA) thread, but the thread that calls into the interface members later on is a multithreaded apartment (MTA) thread. Windows Forms controls are meant to run on STA threads.
|
// This is important, because the thread that instantiates the preview handler component and calls its constructor is a single-threaded apartment (STA) thread, but the thread that calls into the interface members later on is a multithreaded apartment (MTA) thread. Windows Forms controls are meant to run on STA threads.
|
||||||
// More details: https://docs.microsoft.com/en-us/archive/msdn-magazine/2007/january/windows-vista-and-office-writing-your-own-preview-handlers.
|
// More details: https://learn.microsoft.com/archive/msdn-magazine/2007/january/windows-vista-and-office-writing-your-own-preview-handlers.
|
||||||
var forceCreation = this.Handle;
|
var forceCreation = this.Handle;
|
||||||
|
|
||||||
this.FormBorderStyle = FormBorderStyle.None;
|
this.FormBorderStyle = FormBorderStyle.None;
|
||||||
|
@ -14,7 +14,7 @@ namespace Common
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Directs the preview handler to return the HWND from calling the GetFocus function.
|
/// Directs the preview handler to return the HWND from calling the GetFocus function.
|
||||||
/// Source: https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ipreviewhandler-queryfocus.
|
/// Source: https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ipreviewhandler-queryfocus.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">Returns the handle of the window with focus.</param>
|
/// <param name="result">Returns the handle of the window with focus.</param>
|
||||||
void QueryFocus(out IntPtr result);
|
void QueryFocus(out IntPtr result);
|
||||||
@ -26,7 +26,7 @@ namespace Common
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the font according to the font set in Windows Settings.
|
/// Sets the font according to the font set in Windows Settings.
|
||||||
/// More details: https://docs.microsoft.com/en-us/windows/win32/shell/building-preview-handlers#ipreviewhandlervisualssetfont.
|
/// More details: https://learn.microsoft.com/windows/win32/shell/building-preview-handlers#ipreviewhandlervisualssetfont.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="font">Instance of Font.</param>
|
/// <param name="font">Instance of Font.</param>
|
||||||
void SetFont(Font font);
|
void SetFont(Font font);
|
||||||
|
@ -99,7 +99,7 @@ namespace Common
|
|||||||
public uint TranslateAccelerator(ref MSG pmsg)
|
public uint TranslateAccelerator(ref MSG pmsg)
|
||||||
{
|
{
|
||||||
// Current implementation simply directs all Keystrokes to IPreviewHandlerFrame. This is the recommended approach to handle keystokes for all low-integrity preview handlers.
|
// Current implementation simply directs all Keystrokes to IPreviewHandlerFrame. This is the recommended approach to handle keystokes for all low-integrity preview handlers.
|
||||||
// Source: https://docs.microsoft.com/en-us/windows/win32/shell/building-preview-handlers#ipreviewhandlertranslateaccelerator
|
// Source: https://learn.microsoft.com/windows/win32/shell/building-preview-handlers#ipreviewhandlertranslateaccelerator
|
||||||
if (this.frame != null)
|
if (this.frame != null)
|
||||||
{
|
{
|
||||||
return this.frame.TranslateAccelerator(ref pmsg);
|
return this.frame.TranslateAccelerator(ref pmsg);
|
||||||
@ -118,14 +118,14 @@ namespace Common
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void ContextSensitiveHelp(bool fEnterMode)
|
public void ContextSensitiveHelp(bool fEnterMode)
|
||||||
{
|
{
|
||||||
// Should always return NotImplementedException. Source: https://docs.microsoft.com/en-us/windows/win32/shell/building-preview-handlers#iolewindowcontextsensitivehelp
|
// Should always return NotImplementedException. Source: https://learn.microsoft.com/windows/win32/shell/building-preview-handlers#iolewindowcontextsensitivehelp
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void SetSite(object pUnkSite)
|
public void SetSite(object pUnkSite)
|
||||||
{
|
{
|
||||||
// Implementation logic details: https://docs.microsoft.com/en-us/windows/win32/shell/building-preview-handlers#iobjectwithsitesetsite
|
// Implementation logic details: https://learn.microsoft.com/windows/win32/shell/building-preview-handlers#iobjectwithsitesetsite
|
||||||
this.unkSite = pUnkSite;
|
this.unkSite = pUnkSite;
|
||||||
this.frame = this.unkSite as IPreviewHandlerFrame;
|
this.frame = this.unkSite as IPreviewHandlerFrame;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ const CLSID CLSID_SHIMActivateSvgPreviewHandler = { 0x74619BDA, 0xA66B, 0x451D,
|
|||||||
|
|
||||||
// ddee2b8a-6807-48a6-bb20-2338174ff779
|
// ddee2b8a-6807-48a6-bb20-2338174ff779
|
||||||
// CLSID of the .Net Com Class for Preview Handler. Should be included in the registry.dat file under \Classes\CLSID\{guid}.
|
// CLSID of the .Net Com Class for Preview Handler. Should be included in the registry.dat file under \Classes\CLSID\{guid}.
|
||||||
// More details here: https://docs.microsoft.com/en-us/dotnet/framework/interop/registering-assemblies-with-com
|
// More details here: https://learn.microsoft.com/dotnet/framework/interop/registering-assemblies-with-com
|
||||||
const CLSID CLSID_SvgPreviewHandler = { 0xddee2b8a, 0x6807, 0x48a6, { 0xbb, 0x20, 0x23, 0x38, 0x17, 0x4f, 0xf7, 0x79 } };
|
const CLSID CLSID_SvgPreviewHandler = { 0xddee2b8a, 0x6807, 0x48a6, { 0xbb, 0x20, 0x23, 0x38, 0x17, 0x4f, 0xf7, 0x79 } };
|
||||||
|
|
||||||
// E0907A95-6F9A-4D1B-A97A-7D9D2648881E
|
// E0907A95-6F9A-4D1B-A97A-7D9D2648881E
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<application>
|
<application>
|
||||||
<!-- Required for C++ XAML Islands projects that execute from runner (i.e. Keyboard Manager). More details at https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands-cpp#create-a-desktop-application-project -->
|
<!-- Required for C++ XAML Islands projects that execute from runner (i.e. Keyboard Manager). More details at https://learn.microsoft.com/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands-cpp#create-a-desktop-application-project -->
|
||||||
<maxversiontested Id="10.0.19041.0"/>
|
<maxversiontested Id="10.0.19041.0"/>
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
|
@ -16,7 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added a parameterless constructor because of an exception during deserialization. More details here: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to#deserialization-behavior
|
// Added a parameterless constructor because of an exception during deserialization. More details here: https://learn.microsoft.com/dotnet/standard/serialization/system-text-json-how-to#deserialization-behavior
|
||||||
public GenericProperty()
|
public GenericProperty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// <param name="ctrl">Should Ctrl key be used</param>
|
/// <param name="ctrl">Should Ctrl key be used</param>
|
||||||
/// <param name="alt">Should Alt key be used</param>
|
/// <param name="alt">Should Alt key be used</param>
|
||||||
/// <param name="shift">Should Shift key be used</param>
|
/// <param name="shift">Should Shift key be used</param>
|
||||||
/// <param name="code">Go to https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes to see list of v-keys</param>
|
/// <param name="code">Go to https://learn.microsoft.com/windows/win32/inputdev/virtual-key-codes to see list of v-keys</param>
|
||||||
public HotkeySettings(bool win, bool ctrl, bool alt, bool shift, int code)
|
public HotkeySettings(bool win, bool ctrl, bool alt, bool shift, int code)
|
||||||
{
|
{
|
||||||
Win = win;
|
Win = win;
|
||||||
@ -131,7 +131,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
{
|
{
|
||||||
switch (Code)
|
switch (Code)
|
||||||
{
|
{
|
||||||
// https://docs.microsoft.com/en-us/uwp/api/windows.system.virtualkey?view=winrt-20348
|
// https://learn.microsoft.com/uwp/api/windows.system.virtualkey?view=winrt-20348
|
||||||
case 38: // The Up Arrow key or button.
|
case 38: // The Up Arrow key or button.
|
||||||
case 40: // The Down Arrow key or button.
|
case 40: // The Down Arrow key or button.
|
||||||
case 37: // The Left Arrow key or button.
|
case 37: // The Left Arrow key or button.
|
||||||
|
@ -16,7 +16,7 @@ namespace CommonLibTest
|
|||||||
public class BasePTModuleSettingsTest
|
public class BasePTModuleSettingsTest
|
||||||
{
|
{
|
||||||
// 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://learn.microsoft.com/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.
|
||||||
// Test also fails when the attributes are not initialized i.e they have null values.
|
// Test also fails when the attributes are not initialized i.e they have null values.
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[ObsoleteAttribute("This test method is obsolete.", true)]
|
[ObsoleteAttribute("This test method is obsolete.", true)]
|
||||||
|
@ -56,7 +56,7 @@ If a remote test machine is being used, the IP of the test machine must be used
|
|||||||
|
|
||||||
### Extra tools and information
|
### Extra tools and information
|
||||||
|
|
||||||
For tests creation you will need a tool that enables you select any UI element and view the element's accessibility data. For this purpose you could use [AccessibilityInsights](https://accessibilityinsights.io/docs/en/windows/overview) or [Inspect](https://docs.microsoft.com/ru-ru/windows/win32/winauto/inspect-objects?redirectedfrom=MSDN).
|
For tests creation you will need a tool that enables you select any UI element and view the element's accessibility data. For this purpose you could use [AccessibilityInsights](https://accessibilityinsights.io/docs/en/windows/overview) or [Inspect](https://learn.microsoft.com/windows/win32/winauto/inspect-objects?redirectedfrom=MSDN).
|
||||||
|
|
||||||
* `inspect.exe` you can find installed at `C:\Program Files (x86)\Windows Kits\10\bin\<version>\<platform>\inspect.exe`
|
* `inspect.exe` you can find installed at `C:\Program Files (x86)\Windows Kits\10\bin\<version>\<platform>\inspect.exe`
|
||||||
* `AccessibilityInsights` you can download [here](https://aka.ms/accessibilityinsights-windows/download)
|
* `AccessibilityInsights` you can download [here](https://aka.ms/accessibilityinsights-windows/download)
|
||||||
|
@ -24,7 +24,7 @@ foreach ($line in Get-Content $stringTableFile) {
|
|||||||
# Save the text to a file
|
# Save the text to a file
|
||||||
Set-Content -Path $tempFile -Value $newLinesForTempFile
|
Set-Content -Path $tempFile -Value $newLinesForTempFile
|
||||||
|
|
||||||
# Use resgen to parse the txt to resx. More details at https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator#converting-between-resource-file-types
|
# Use resgen to parse the txt to resx. More details at https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#converting-between-resource-file-types
|
||||||
resgen $tempFile $resxFile
|
resgen $tempFile $resxFile
|
||||||
|
|
||||||
# Delete temporary text file used by resgen
|
# Delete temporary text file used by resgen
|
||||||
|
Loading…
Reference in New Issue
Block a user