2020-07-07 07:15:45 +12:00
// <copyright file="TrackPopupMenuEx.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
2020-03-28 08:43:16 +13:00
2020-03-30 06:26:45 +13:00
namespace SystemTrayMenu.DllImports
2020-03-28 08:43:16 +13:00
{
2020-07-07 07:15:45 +12:00
using System ;
using System.Runtime.InteropServices ;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
2020-03-28 08:43:16 +13:00
public static partial class NativeMethods
{
2020-07-07 07:15:45 +12:00
/// <summary>
/// Specifies how TrackPopupMenuEx positions the shortcut menu horizontally.
/// </summary>
2020-03-28 08:43:16 +13:00
[Flags]
2020-03-30 00:20:18 +13:00
internal enum TPM : uint
2020-03-28 08:43:16 +13:00
{
2020-07-07 07:15:45 +12:00
#pragma warning disable SA1602 // Enumeration items should be documented
LEFTBUTTON = 0x0000 , // LEFTALIGN = 0x0000, // TOPALIGN = 0x0000, // HORIZONTAL = 0x0000,
2020-03-28 08:43:16 +13:00
RIGHTBUTTON = 0x0002 ,
CENTERALIGN = 0x0004 ,
RIGHTALIGN = 0x0008 ,
VCENTERALIGN = 0x0010 ,
BOTTOMALIGN = 0x0020 ,
VERTICAL = 0x0040 ,
NONOTIFY = 0x0080 ,
RETURNCMD = 0x0100 ,
RECURSE = 0x0001 ,
HORPOSANIMATION = 0x0400 ,
HORNEGANIMATION = 0x0800 ,
VERPOSANIMATION = 0x1000 ,
VERNEGANIMATION = 0x2000 ,
NOANIMATION = 0x4000 ,
2020-07-07 07:15:45 +12:00
LAYOUTRTL = 0x8000 ,
#pragma warning restore SA1602 // Enumeration items should be documented
2020-03-28 08:43:16 +13:00
}
2020-07-07 07:15:45 +12:00
/// <summary>
/// user32 TrackPopupMenuEx.
/// </summary>
/// <param name="hmenu">hmenu.</param>
/// <param name="flags">flags.</param>
/// <param name="x">x.</param>
/// <param name="y">y.</param>
/// <param name="hwnd">hwnd.</param>
/// <param name="lptpm">lptpm.</param>
/// <returns>uint.</returns>
internal static uint User32TrackPopupMenuEx ( IntPtr hmenu , TPM flags , int x , int y , IntPtr hwnd , IntPtr lptpm )
{
return TrackPopupMenuEx ( hmenu , flags , x , y , hwnd , lptpm ) ;
}
// The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen.
2020-10-20 00:11:41 +13:00
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)]
2021-04-17 12:39:48 +12:00
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
2020-07-07 07:15:45 +12:00
private static extern uint TrackPopupMenuEx ( IntPtr hmenu , TPM flags , int x , int y , IntPtr hwnd , IntPtr lptpm ) ;
2020-03-28 08:43:16 +13:00
}
}