mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* adjustments * Settings fixed * Getting resizing tests operational again * fixed default vs loading from settings * one small tewak
82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
// 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.
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1636:FileHeaderCopyrightTextMustMatch", Justification = "File created under PowerToys.")]
|
|
|
|
namespace ImageResizer.Utilities
|
|
{
|
|
// Win32 functions required for temporary workaround for issue #1273
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Naming used in Win32 dll")]
|
|
internal class NativeMethods
|
|
{
|
|
[DllImport("user32.dll")]
|
|
internal static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
|
|
[DllImport("user32.dll")]
|
|
internal static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct INPUT
|
|
{
|
|
internal INPUTTYPE type;
|
|
internal InputUnion data;
|
|
|
|
internal static int Size
|
|
{
|
|
get { return Marshal.SizeOf(typeof(INPUT)); }
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
internal struct InputUnion
|
|
{
|
|
[FieldOffset(0)]
|
|
internal MOUSEINPUT mi;
|
|
[FieldOffset(0)]
|
|
internal KEYBDINPUT ki;
|
|
[FieldOffset(0)]
|
|
internal HARDWAREINPUT hi;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct MOUSEINPUT
|
|
{
|
|
internal int dx;
|
|
internal int dy;
|
|
internal int mouseData;
|
|
internal uint dwFlags;
|
|
internal uint time;
|
|
internal UIntPtr dwExtraInfo;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct KEYBDINPUT
|
|
{
|
|
internal short wVk;
|
|
internal short wScan;
|
|
internal uint dwFlags;
|
|
internal int time;
|
|
internal UIntPtr dwExtraInfo;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct HARDWAREINPUT
|
|
{
|
|
internal int uMsg;
|
|
internal short wParamL;
|
|
internal short wParamH;
|
|
}
|
|
|
|
internal enum INPUTTYPE : uint
|
|
{
|
|
INPUT_MOUSE = 0,
|
|
INPUT_KEYBOARD = 1,
|
|
INPUT_HARDWARE = 2,
|
|
}
|
|
}
|
|
}
|