// // Copyright (c) PlaceholderCompany. All rights reserved. // namespace SystemTrayMenu.DllImports { using System; using System.Runtime.InteropServices; /// /// wraps the methodcalls to native windows dll's. /// public static partial class NativeMethods { /// /// Specifies how TrackPopupMenuEx positions the shortcut menu horizontally. /// [Flags] internal enum TPM : uint { LEFTBUTTON = 0x0000, // LEFTALIGN = 0x0000, // TOPALIGN = 0x0000, // HORIZONTAL = 0x0000, 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, LAYOUTRTL = 0x8000, } /// /// user32 TrackPopupMenuEx. /// /// hmenu. /// flags. /// x. /// y. /// hwnd. /// lptpm. /// uint. 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. [DllImport("user32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)] [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern uint TrackPopupMenuEx(IntPtr hmenu, TPM flags, int x, int y, IntPtr hwnd, IntPtr lptpm); } }