mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-06 12:42:02 +12:00
Adjust namespace Enforce calling conventions Mark as Windows specific API Remove empty wrapper calls Remove obsolete calls Combine/group logically in files instead of "by function"
70 lines
2.1 KiB
C#
70 lines
2.1 KiB
C#
// <copyright file="TaskBar.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace SystemTrayMenu.DllImports
|
|
{
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.Versioning;
|
|
|
|
/// <summary>
|
|
/// wraps the methodcalls to native windows dll's.
|
|
/// </summary>
|
|
public static partial class NativeMethods
|
|
{
|
|
internal enum ABM : uint
|
|
{
|
|
New = 0x00000000,
|
|
Remove = 0x00000001,
|
|
QueryPos = 0x00000002,
|
|
SetPos = 0x00000003,
|
|
GetState = 0x00000004,
|
|
GetTaskbarPos = 0x00000005,
|
|
Activate = 0x00000006,
|
|
GetAutoHideBar = 0x00000007,
|
|
SetAutoHideBar = 0x00000008,
|
|
WindowPosChanged = 0x00000009,
|
|
SetState = 0x0000000A,
|
|
}
|
|
|
|
internal enum ABE : uint
|
|
{
|
|
Left = 0,
|
|
Top = 1,
|
|
Right = 2,
|
|
Bottom = 3,
|
|
}
|
|
|
|
[SupportedOSPlatform("windows")]
|
|
[DllImport("shell32.dll", EntryPoint = "SHAppBarMessage", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
|
|
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
|
|
internal static extern IntPtr Shell32SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
internal struct APPBARDATA
|
|
{
|
|
public uint cbSize;
|
|
public IntPtr hWnd;
|
|
public uint uCallbackMessage;
|
|
public ABE uEdge;
|
|
public RECT rc;
|
|
public int lParam;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
internal struct RECT
|
|
{
|
|
public int left;
|
|
public int top;
|
|
public int right;
|
|
public int bottom;
|
|
}
|
|
|
|
internal static class ABS
|
|
{
|
|
public const int Autohide = 0x0000001;
|
|
public const int AlwaysOnTop = 0x0000002;
|
|
}
|
|
}
|
|
}
|