2020-10-08 08:45:09 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
2021-07-28 17:26:06 +03:00
|
|
|
|
using System;
|
2020-10-08 08:45:09 -07:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
|
|
|
|
|
{
|
2021-03-02 20:56:37 +03:00
|
|
|
|
public static class NativeMethods
|
2020-10-08 08:45:09 -07:00
|
|
|
|
{
|
|
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
internal static extern uint SendInput(uint nInputs, NativeKeyboardHelper.INPUT[] pInputs, int cbSize);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
|
|
|
|
|
|
internal static extern short GetAsyncKeyState(int vKey);
|
2020-10-29 14:24:16 -07:00
|
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
|
#pragma warning disable CA1401 // P/Invokes should not be visible
|
2020-10-29 14:24:16 -07:00
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
|
2021-03-02 20:56:37 +03:00
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
public static extern bool AllowSetForegroundWindow(int dwProcessId);
|
2021-07-28 17:26:06 +03:00
|
|
|
|
|
|
|
|
|
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
|
|
|
|
|
public static extern IntPtr LoadLibrary(string dllToLoad);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
|
|
|
|
|
|
public static extern bool FreeLibrary(IntPtr hModule);
|
2021-03-02 20:56:37 +03:00
|
|
|
|
#pragma warning restore CA1401 // P/Invokes should not be visible
|
2020-10-08 08:45:09 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|