microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ecec6489db2ad85ccd1be99c0860dc3b057af2b1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

dotnet/autoShell/Services/ISystemParametersService.cs

75lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#nullable enable
5
6using System;
7
8namespace autoShell.Services;
9
10/// <summary>
11/// Abstracts SystemParametersInfo and related Win32 system parameter calls for testability.
12/// </summary>
13internal interface ISystemParametersService
14{
15 /// <summary>
16 /// Sets a system parameter via SystemParametersInfo with an IntPtr value.
17 /// </summary>
18 /// <param name="action">The system parameter action constant (SPI_SET*).</param>
19 /// <param name="param">Additional parameter whose meaning depends on the action.</param>
20 /// <param name="vparam">Pointer to the value to set.</param>
21 /// <param name="flags">Flags controlling persistence and notification (SPIF_*).</param>
22 bool SetParameter(int action, int param, IntPtr vparam, int flags);
23
24 /// <summary>
25 /// Sets a system parameter via SystemParametersInfo with a string value.
26 /// </summary>
27 /// <param name="action">The system parameter action constant (SPI_SET*).</param>
28 /// <param name="param">Additional parameter whose meaning depends on the action.</param>
29 /// <param name="vparam">The string value to set.</param>
30 /// <param name="flags">Flags controlling persistence and notification (SPIF_*).</param>
31 bool SetParameter(int action, int param, string vparam, int flags);
32
33 /// <summary>
34 /// Sets a system parameter via SystemParametersInfo with an int array value.
35 /// </summary>
36 /// <param name="action">The system parameter action constant (SPI_SET*).</param>
37 /// <param name="param">Additional parameter whose meaning depends on the action.</param>
38 /// <param name="vparam">Array containing the value to set.</param>
39 /// <param name="flags">Flags controlling persistence and notification (SPIF_*).</param>
40 bool SetParameter(int action, int param, int[] vparam, int flags);
41
42 /// <summary>
43 /// Gets a system parameter via SystemParametersInfo into an int array.
44 /// </summary>
45 /// <param name="action">The system parameter action constant (SPI_GET*).</param>
46 /// <param name="param">Additional parameter whose meaning depends on the action.</param>
47 /// <param name="vparam">Array to receive the value.</param>
48 /// <param name="flags">Flags (typically 0 for get operations).</param>
49 bool GetParameter(int action, int param, int[] vparam, int flags);
50
51 /// <summary>
52 /// Swaps the primary and secondary mouse buttons.
53 /// </summary>
54 /// <param name="swap">If true, swaps the buttons; if false, restores default.</param>
55 bool SwapMouseButton(bool swap);
56
57 /// <summary>
58 /// Enables or disables Filter Keys via SystemParametersInfo(SPI_SETFILTERKEYS).
59 /// </summary>
60 bool SetFilterKeys(bool enable);
61
62 /// <summary>
63 /// Enables or disables Sticky Keys via SystemParametersInfo(SPI_SETSTICKYKEYS).
64 /// </summary>
65 bool SetStickyKeys(bool enable);
66
67 /// <summary>
68 /// Loads a string resource from a native DLL by resource ID.
69 /// Used to resolve localized display names (e.g., theme names from themeui.dll).
70 /// </summary>
71 /// <param name="dllPath">Full path to the DLL containing the string resource.</param>
72 /// <param name="resourceId">The resource ID of the string to load.</param>
73 /// <returns>The loaded string, or null if the resource could not be found.</returns>
74 string? LoadStringResource(string dllPath, int resourceId);
75}