mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* [Power Toys - Fancy Zones] Focus problem when activating layour editor is solved. * haveTriedToGetFocusAlready variable added for focusing one time. * [Power Toys - Fancy Zones] Functions are added to NativeMethods.cs
39 lines
1.4 KiB
C#
39 lines
1.4 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;
|
|
|
|
namespace FancyZonesEditor
|
|
{
|
|
// PInvokes to handshake with fancyzones backend
|
|
internal static class NativeMethods
|
|
{
|
|
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
|
|
public static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
|
|
|
|
[DllImport("kernel32", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
|
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
|
|
|
|
[DllImport("user32.dll")]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern IntPtr GetForegroundWindow();
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
|
|
|
|
[DllImport("kernel32.dll")]
|
|
public static extern uint GetCurrentThreadId();
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
|
|
}
|
|
}
|