├── Package └── Chocolatey │ ├── icon.png │ ├── tools │ └── chocolateyinstall.ps1 │ ├── update.ps1 │ └── smartcontextmenu.nuspec ├── SmartContextMenu ├── Images │ ├── ArrowUp.png │ ├── ArrowDown.png │ ├── SmartContextMenu.ico │ ├── SmartContextMenu.png │ ├── SmartContextMenuCn1.png │ ├── SmartContextMenuCn2.png │ ├── SmartContextMenuCn3.png │ ├── SmartContextMenuEn1.png │ ├── SmartContextMenuEn2.png │ ├── SmartContextMenuEn3.png │ ├── SmartContextMenuKo1.png │ ├── SmartContextMenuKo2.png │ ├── SmartContextMenuKo3.png │ ├── SmartContextMenuLogo.png │ ├── SmartContextMenuRu1.png │ ├── SmartContextMenuRu2.png │ └── SmartContextMenuRu3.png ├── SmartContextMenu.ico ├── Native │ ├── Enums │ │ ├── WindowCompositionAttribute.cs │ │ ├── DwmBB.cs │ │ ├── LayeredWindow.cs │ │ ├── ProcessDpiAwareness.cs │ │ ├── Priority.cs │ │ ├── AccentState.cs │ │ ├── DpiAwarenessContext.cs │ │ ├── PriorityClass.cs │ │ ├── ThreadAccess.cs │ │ ├── ShowWindowCommands.cs │ │ ├── WindowShowStyle.cs │ │ ├── ProcessAccess.cs │ │ └── CopyPixelOperations.cs │ ├── Structs │ │ ├── SmallRect.cs │ │ ├── Coord.cs │ │ ├── Point.cs │ │ ├── ICONINFO.cs │ │ ├── AccentPolicy.cs │ │ ├── Rect.cs │ │ ├── DwmBlurBehind.cs │ │ ├── ConsoleScreenBufferInfo.cs │ │ ├── WindowCompositionAttributeData.cs │ │ ├── TitlebarInfo.cs │ │ ├── MonitorInfo.cs │ │ ├── MouseLLHookStruct.cs │ │ ├── KeyboardLLHookStruct.cs │ │ ├── ProcessBasicInformation.cs │ │ ├── CURSORINFO.cs │ │ ├── WindowPlacement.cs │ │ └── WindowInfo.cs │ ├── SHCore.cs │ ├── Ntdll.cs │ ├── Dwmapi.cs │ ├── Gdi32.cs │ ├── Kernel32.cs │ └── Constants.cs ├── Settings │ ├── MenuItemType.cs │ ├── MoveToMenuItem.cs │ ├── DimmerSettings.cs │ ├── MenuItems.cs │ ├── WindowSizeMenuItem.cs │ ├── MenuItem.cs │ └── StartProgramMenuItem.cs ├── WindowSizerType.cs ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ └── Resources.Designer.cs ├── EventArgs.cs ├── Win32Window.cs ├── Controls │ ├── DataGridViewDisableButtonColumn.cs │ └── DataGridViewDisableButtonCell.cs ├── Extensions │ ├── IEnumerableExtensions.cs │ ├── EnumExtensions.cs │ ├── PriorityClassExtensions.cs │ ├── PriorityExtensions.cs │ ├── StringExtensions.cs │ └── ProcessExtensions.cs ├── Hooks │ ├── MouseButton.cs │ ├── VirtualKeyModifier.cs │ ├── KeyboardEventArgs.cs │ └── MouseHook.cs ├── ProcessInfo.cs ├── WindowAlignment.cs ├── Utils │ ├── FileUtils.cs │ ├── AssemblyUtils.cs │ └── EnumUtils.cs ├── Forms │ ├── MessageBoxForm.cs │ ├── DimForm.cs │ ├── AboutForm.cs │ ├── ParameterForm.cs │ ├── DimForm.Designer.cs │ ├── TitleForm.cs │ ├── MainForm.Designer.cs │ ├── PositionForm.cs │ ├── SizeForm.cs │ ├── TransparencyForm.cs │ ├── HotkeysForm.cs │ ├── TransparencyForm.Designer.cs │ ├── ParameterForm.Designer.cs │ ├── MessageBoxForm.Designer.cs │ ├── TitleForm.Designer.cs │ ├── PositionForm.Designer.cs │ ├── SizeSettingsForm.cs │ ├── AboutForm.Designer.cs │ ├── StartProgramForm.cs │ ├── InformationForm.cs │ ├── SizeForm.Designer.cs │ └── HotkeysForm.Designer.cs ├── CommandLineParser.cs ├── AutoStarter.cs ├── ContextMenuItemValue.cs ├── LanguageManager.cs ├── app.manifest ├── WindowDetails.cs └── MenuItemName.cs ├── LICENSE ├── SmartContextMenu.sln ├── .gitignore ├── README_CN.md ├── README_KO.md ├── README_RU.md └── README.md /Package/Chocolatey/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/Package/Chocolatey/icon.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/ArrowUp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/ArrowUp.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/ArrowDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/ArrowDown.png -------------------------------------------------------------------------------- /SmartContextMenu/SmartContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/SmartContextMenu.ico -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenu.ico -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenu.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuCn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuCn1.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuCn2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuCn2.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuCn3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuCn3.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuEn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuEn1.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuEn2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuEn2.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuEn3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuEn3.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuKo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuKo1.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuKo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuKo2.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuKo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuKo3.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuLogo.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuRu1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuRu1.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuRu2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuRu2.png -------------------------------------------------------------------------------- /SmartContextMenu/Images/SmartContextMenuRu3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexanderPro/SmartContextMenu/HEAD/SmartContextMenu/Images/SmartContextMenuRu3.png -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/WindowCompositionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum WindowCompositionAttribute 4 | { 5 | WCA_ACCENT_POLICY = 19 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /SmartContextMenu/Settings/MenuItemType.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Settings 2 | { 3 | public enum MenuItemType 4 | { 5 | Item = 0, 6 | Group = 1, 7 | Separator = 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SmartContextMenu/WindowSizerType.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu 2 | { 3 | public enum WindowSizerType : int 4 | { 5 | WindowWithMargins = 0x00, 6 | WindowWithoutMargins = 0x01, 7 | WindowClientArea = 0x03 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/DwmBB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Native.Enums 4 | { 5 | [Flags] 6 | enum DwmBB 7 | { 8 | Enable = 1, 9 | BlurRegion = 2, 10 | TransitionMaximized = 4 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/LayeredWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Native.Enums 4 | { 5 | [Flags] 6 | enum LayeredWindow : uint 7 | { 8 | LWA_COLORKEY = 0x00000001, 9 | LWA_ALPHA = 0x00000002 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/ProcessDpiAwareness.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum ProcessDpiAwareness 4 | { 5 | Process_DPI_Unaware = 0, 6 | Process_System_DPI_Aware = 1, 7 | Process_Per_Monitor_DPI_Aware = 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SmartContextMenu/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/Priority.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | public enum Priority : int 4 | { 5 | RealTime = 24, 6 | High = 13, 7 | AboveNormal = 10, 8 | Normal = 8, 9 | BelowNormal = 6, 10 | Idle = 4 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SmartContextMenu/EventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu 4 | { 5 | [Serializable] 6 | public class EventArgs : EventArgs 7 | { 8 | public T Entity { get; } 9 | 10 | public EventArgs(T entity) 11 | { 12 | Entity = entity; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/AccentState.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum AccentState 4 | { 5 | ACCENT_DISABLED = 0, 6 | ACCENT_ENABLE_GRADIENT = 1, 7 | ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, 8 | ACCENT_ENABLE_BLURBEHIND = 3, 9 | ACCENT_INVALID_STATE = 4 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SmartContextMenu/Win32Window.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu 5 | { 6 | class Win32Window : IWin32Window 7 | { 8 | public IntPtr Handle { get; } 9 | 10 | public Win32Window(IntPtr handle) 11 | { 12 | Handle = handle; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/SmallRect.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct SmallRect 7 | { 8 | public short Left; 9 | public short Top; 10 | public short Right; 11 | public short Bottom; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/DpiAwarenessContext.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum DpiAwarenessContext 4 | { 5 | DPI_AWARENESS_CONTEXT_UNAWARE = 16, 6 | DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17, 7 | DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18, 8 | DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/SHCore.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using SmartContextMenu.Native.Enums; 3 | 4 | namespace SmartContextMenu.Native 5 | { 6 | static class SHCore 7 | { 8 | [DllImport("SHCore.dll", SetLastError = true)] 9 | public static extern bool SetProcessDpiAwareness(ProcessDpiAwareness processDpiAwareness); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SmartContextMenu/Controls/DataGridViewDisableButtonColumn.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace SmartContextMenu.Controls 4 | { 5 | public class DataGridViewDisableButtonColumn : DataGridViewButtonColumn 6 | { 7 | public DataGridViewDisableButtonColumn() 8 | { 9 | this.CellTemplate = new DataGridViewDisableButtonCell(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/IEnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SmartContextMenu.Extensions 6 | { 7 | public static class IEnumerableExtensions 8 | { 9 | public static IEnumerable Flatten(this IEnumerable e, Func> f) => e.SelectMany(c => f(c).Flatten(f)).Concat(e); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/Coord.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct Coord 7 | { 8 | public short X; 9 | public short Y; 10 | 11 | public Coord(short x, short y) 12 | { 13 | X = x; 14 | Y = y; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/Point.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct Point 7 | { 8 | public int x; 9 | public int y; 10 | 11 | public Point(int x, int y) 12 | { 13 | this.x = x; 14 | this.y = y; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/ICONINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct ICONINFO 8 | { 9 | public bool fIcon; 10 | public Int32 xHotspot; 11 | public Int32 yHotspot; 12 | public IntPtr hbmMask; 13 | public IntPtr hbmColor; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SmartContextMenu/Hooks/MouseButton.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SmartContextMenu.Hooks 4 | { 5 | public enum MouseButton : int 6 | { 7 | [Description("None")] 8 | None = 0x00, 9 | 10 | [Description("Left")] 11 | Left = 0x01, 12 | 13 | [Description("Right")] 14 | Right = 0x02, 15 | 16 | [Description("Middle")] 17 | Middle = 0x03 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/AccentPolicy.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using SmartContextMenu.Native.Enums; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct AccentPolicy 8 | { 9 | public AccentState AccentState; 10 | public int AccentFlags; 11 | public int GradientColor; 12 | public int AnimationId; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/ProcessInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu 2 | { 3 | class ProcessInfo 4 | { 5 | public string CommandLine { get; set; } 6 | 7 | public uint HandleCount { get; set; } 8 | 9 | public uint ThreadCount { get; set; } 10 | 11 | public ulong VirtualSize { get; set; } 12 | 13 | public ulong WorkingSetSize { get; set; } 14 | 15 | public string Owner { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/WindowAlignment.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu 2 | { 3 | public enum WindowAlignment 4 | { 5 | TopLeft = 1, 6 | TopCenter = 2, 7 | TopRight = 3, 8 | MiddleLeft = 4, 9 | MiddleCenter= 5, 10 | MiddleRight = 6, 11 | BottomLeft = 7, 12 | BottomCenter = 8, 13 | BottomRight = 9, 14 | CenterHorizontally = 10, 15 | CenterVertically = 11 16 | } 17 | } -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/Rect.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct Rect 7 | { 8 | public int Left; 9 | public int Top; 10 | public int Right; 11 | public int Bottom; 12 | 13 | public int Width => Right - Left; 14 | public int Height => Bottom - Top; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/DwmBlurBehind.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Enums; 4 | 5 | namespace SmartContextMenu.Native.Structs 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | struct DwmBlurBehind 9 | { 10 | public DwmBB dwFlags; 11 | public bool fEnable; 12 | public IntPtr hRgnBlur; 13 | public bool fTransitionOnMaximized; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/ConsoleScreenBufferInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct ConsoleScreenBufferInfo 7 | { 8 | public Coord dwSize; 9 | public Coord dwCursorPosition; 10 | public ushort wAttributes; 11 | public SmallRect srWindow; 12 | public Coord dwMaximumWindowSize; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/WindowCompositionAttributeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Enums; 4 | 5 | namespace SmartContextMenu.Native.Structs 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | struct WindowCompositionAttributeData 9 | { 10 | public WindowCompositionAttribute Attribute; 11 | public IntPtr Data; 12 | public int SizeOfData; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/Settings/MoveToMenuItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Settings 4 | { 5 | class MoveToMenuItem 6 | { 7 | public int MonitorIndex { get; } 8 | 9 | public IntPtr MonitorHandle { get; set; } 10 | 11 | public MoveToMenuItem(int monitorId, IntPtr monitorHandle) 12 | { 13 | MonitorIndex = monitorId; 14 | MonitorHandle = monitorHandle; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Ntdll.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Structs; 4 | 5 | namespace SmartContextMenu.Native 6 | { 7 | static class Ntdll 8 | { 9 | [DllImport("ntdll.dll")] 10 | public static extern int NtQueryInformationProcess(IntPtr processHandle, int processInformationClass, ref ProcessBasicInformation pbi, int processInformationLength, out int returnLength); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/TitlebarInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct TitlebarInfo 7 | { 8 | public const int CCHILDREN_TITLEBAR = 5; 9 | public uint cbSize; 10 | public Rect rcTitleBar; 11 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = CCHILDREN_TITLEBAR + 1)] 12 | public uint[] rgstate; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/MonitorInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct MonitorInfo 7 | { 8 | public uint cbSize; 9 | public Rect rcMonitor; 10 | public Rect rcWork; 11 | public uint dwFlags; 12 | 13 | public void Init() 14 | { 15 | cbSize = (uint)Marshal.SizeOf(this); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SmartContextMenu/Settings/DimmerSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Settings 4 | { 5 | public class DimmerSettings : ICloneable 6 | { 7 | public string Color { get; set; } 8 | 9 | public int Transparency { get; set; } 10 | 11 | public DimmerSettings() 12 | { 13 | Color = string.Empty; 14 | Transparency = 0; 15 | } 16 | 17 | public object Clone() => MemberwiseClone(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/MouseLLHookStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct MouseLLHookStruct 8 | { 9 | public Point pt; 10 | public int mouseData; 11 | public int flags; 12 | public int time; 13 | public int dwExtraInfo; 14 | } 15 | 16 | delegate int MouseHookProc(int code, int wParam, IntPtr lParam); 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/PriorityClass.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum PriorityClass : uint 4 | { 5 | ABOVE_NORMAL_PRIORITY_CLASS = 0x8000, 6 | BELOW_NORMAL_PRIORITY_CLASS = 0x4000, 7 | HIGH_PRIORITY_CLASS = 0x80, 8 | IDLE_PRIORITY_CLASS = 0x40, 9 | NORMAL_PRIORITY_CLASS = 0x20, 10 | PROCESS_MODE_BACKGROUND_BEGIN = 0x100000, 11 | PROCESS_MODE_BACKGROUND_END = 0x200000, 12 | REALTIME_PRIORITY_CLASS = 0x100 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/ThreadAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Native.Enums 4 | { 5 | [Flags] 6 | enum ThreadAccess : int 7 | { 8 | TERMINATE = 0x0001, 9 | SUSPEND_RESUME = 0x0002, 10 | GET_CONTEXT = 0x0008, 11 | SET_CONTEXT = 0x0010, 12 | SET_INFORMATION = 0x0020, 13 | QUERY_INFORMATION = 0x0040, 14 | SET_THREAD_TOKEN = 0x0080, 15 | IMPERSONATE = 0x0100, 16 | DIRECT_IMPERSONATION = 0x0200 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/ShowWindowCommands.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum ShowWindowCommands : int 4 | { 5 | SW_HIDE = 0, 6 | SW_SHOWNORMAL = 1, 7 | SW_SHOWMINIMIZED = 2, 8 | SW_SHOWMAXIMIZED = 3, 9 | SW_SHOWNOACTIVATE = 4, 10 | SW_SHOW = 5, 11 | SW_MINIMIZE = 6, 12 | SW_SHOWMINNOACTIVE = 7, 13 | SW_SHOWNA = 8, 14 | SW_RESTORE = 9, 15 | SW_SHOWDEFAULT = 10, 16 | SW_FORCEMINIMIZE = 11 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/KeyboardLLHookStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct KeyboardLLHookStruct 8 | { 9 | public int vkCode; 10 | public int scanCode; 11 | public int flags; 12 | public int time; 13 | public IntPtr dwExtraInfo; 14 | } 15 | 16 | delegate int KeyboardHookProc(int code, IntPtr wParam, ref KeyboardLLHookStruct lParam); 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/ProcessBasicInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct ProcessBasicInformation 8 | { 9 | public IntPtr Reserved1; 10 | public IntPtr PebBaseAddress; 11 | public IntPtr Reserved2_0; 12 | public IntPtr Reserved2_1; 13 | public IntPtr UniqueProcessId; 14 | public IntPtr InheritedFromUniqueProcessId; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Dwmapi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Structs; 4 | 5 | namespace SmartContextMenu.Native 6 | { 7 | static class Dwmapi 8 | { 9 | [DllImport("dwmapi.dll")] 10 | public static extern void DwmEnableBlurBehindWindow(IntPtr hwnd, ref DwmBlurBehind blurBehind); 11 | 12 | [DllImport("dwmapi.dll")] 13 | public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out Rect pvAttribute, int cbAttribute); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/CURSORINFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SmartContextMenu.Native.Structs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | struct CURSORINFO 8 | { 9 | public Int32 cbSize; 10 | public Int32 flags; 11 | public IntPtr hCursor; 12 | public POINTAPI ptScreenPos; 13 | } 14 | 15 | [StructLayout(LayoutKind.Sequential)] 16 | struct POINTAPI 17 | { 18 | public int x; 19 | public int y; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/WindowPlacement.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Enums; 4 | 5 | namespace SmartContextMenu.Native.Structs 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | struct WindowPlacement 9 | { 10 | public int length; 11 | public int flags; 12 | public ShowWindowCommands showCmd; 13 | public Point ptMinPosition; 14 | public Point ptMaxPosition; 15 | public Rectangle rcNormalPosition; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/WindowShowStyle.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native.Enums 2 | { 3 | enum WindowShowStyle : uint 4 | { 5 | Hide = 0, 6 | ShowNormal = 1, 7 | Normal = 1, 8 | ShowMinimized = 2, 9 | ShowMaximized = 3, 10 | Maximize = 3, 11 | ShowNoActivate = 4, 12 | Show = 5, 13 | Minimize = 6, 14 | ShowMinNoActive = 7, 15 | ShowNa = 8, 16 | Restore = 9, 17 | ShowDefault = 10, 18 | ForceMinimize = 11, 19 | Max = 11 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SmartContextMenu/Hooks/VirtualKeyModifier.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace SmartContextMenu.Hooks 4 | { 5 | public enum VirtualKeyModifier : int 6 | { 7 | [Description("None")] 8 | None = 0x00, 9 | 10 | [Description("Shift")] 11 | Shift = 0x10, 12 | 13 | [Description("Ctrl")] 14 | Ctrl = 0x11, 15 | 16 | [Description("Alt")] 17 | Alt = 0x12, 18 | 19 | [Description("WinL")] 20 | WinL = 0x5B, 21 | 22 | [Description("WinR")] 23 | WinR = 0x5C 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Structs/WindowInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace SmartContextMenu.Native.Structs 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | struct WindowInfo 7 | { 8 | public int cbSize; 9 | public Rect rcWindow; 10 | public Rect rcClient; 11 | public uint dwStyle; 12 | public uint dwExStyle; 13 | public uint dwWindowStatus; 14 | public int cxWindowBorders; 15 | public int cyWindowBorders; 16 | public ushort atomWindowType; 17 | public ushort wCreatorVersion; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SmartContextMenu/Utils/FileUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.IO; 3 | using System.Xml.Linq; 4 | 5 | namespace SmartContextMenu.Utils 6 | { 7 | static class FileUtils 8 | { 9 | public static void Save(string fileName, XDocument document) 10 | { 11 | using var writer = new Utf8StringWriter(); 12 | document.Save(writer, SaveOptions.None); 13 | File.WriteAllText(fileName, writer.ToString()); 14 | } 15 | 16 | private class Utf8StringWriter : StringWriter 17 | { 18 | public override Encoding Encoding { get { return Encoding.UTF8; } } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Package/Chocolatey/tools/chocolateyinstall.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = 'Stop'; 2 | $packageName= 'smartcontextmenu' 3 | $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" 4 | $url = 'https://github.com/AlexanderPro/SmartContextMenu/releases/download/v1.7.2/SmartContextMenu_v1.7.2.zip' 5 | 6 | $packageArgs = @{ 7 | packageName = $packageName 8 | destination = $toolsDir 9 | fileType = 'zip' 10 | url = $url 11 | softwareName = 'SmartContextMenu*' 12 | checksum = '957ba30cedd92e90d66fdb6d565d180e4b153379da7d29a6d512c5485c36bf30' 13 | checksumType = 'sha256' 14 | } 15 | 16 | Install-ChocolateyZipPackage @packageArgs 17 | -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.ComponentModel; 4 | using System.Collections.Generic; 5 | 6 | namespace SmartContextMenu.Extensions 7 | { 8 | static class EnumExtensions 9 | { 10 | public static string GetDescription(this Enum value) => value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault() is not DescriptionAttribute attribute ? null : attribute.Description; 11 | 12 | public static IEnumerable AsEnumerable() where TEnum : IComparable, IConvertible, IFormattable => Enum.GetValues(typeof(TEnum)).Cast(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/ProcessAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Native.Enums 4 | { 5 | [Flags] 6 | enum ProcessAccess : uint 7 | { 8 | All = 0x001F0FFF, 9 | Terminate = 0x00000001, 10 | CreateThread = 0x00000002, 11 | VirtualMemoryOperation = 0x00000008, 12 | VirtualMemoryRead = 0x00000010, 13 | VirtualMemoryWrite = 0x00000020, 14 | DuplicateHandle = 0x00000040, 15 | CreateProcess = 0x000000080, 16 | SetQuota = 0x00000100, 17 | SetInformation = 0x00000200, 18 | QueryInformation = 0x00000400, 19 | QueryLimitedInformation = 0x00001000, 20 | Synchronize = 0x00100000 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/PriorityClassExtensions.cs: -------------------------------------------------------------------------------- 1 | using SmartContextMenu.Native.Enums; 2 | 3 | namespace SmartContextMenu.Extensions 4 | { 5 | static class PriorityClassExtensions 6 | { 7 | public static Priority GetPriority(this PriorityClass priorityClass) => priorityClass switch 8 | { 9 | PriorityClass.REALTIME_PRIORITY_CLASS => Priority.RealTime, 10 | PriorityClass.HIGH_PRIORITY_CLASS => Priority.High, 11 | PriorityClass.ABOVE_NORMAL_PRIORITY_CLASS => Priority.AboveNormal, 12 | PriorityClass.NORMAL_PRIORITY_CLASS => Priority.Normal, 13 | PriorityClass.BELOW_NORMAL_PRIORITY_CLASS => Priority.BelowNormal, 14 | PriorityClass.IDLE_PRIORITY_CLASS => Priority.Idle, 15 | _ => Priority.Normal 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/PriorityExtensions.cs: -------------------------------------------------------------------------------- 1 | using SmartContextMenu.Native.Enums; 2 | 3 | namespace SmartContextMenu.Extensions 4 | { 5 | static class PriorityExtensions 6 | { 7 | public static PriorityClass GetPriorityClass(this Priority priority) => priority switch 8 | { 9 | Priority.RealTime => PriorityClass.REALTIME_PRIORITY_CLASS, 10 | Priority.High => PriorityClass.HIGH_PRIORITY_CLASS, 11 | Priority.AboveNormal => PriorityClass.ABOVE_NORMAL_PRIORITY_CLASS, 12 | Priority.Normal => PriorityClass.NORMAL_PRIORITY_CLASS, 13 | Priority.BelowNormal => PriorityClass.BELOW_NORMAL_PRIORITY_CLASS, 14 | Priority.Idle => PriorityClass.IDLE_PRIORITY_CLASS, 15 | _ => PriorityClass.NORMAL_PRIORITY_CLASS 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/MessageBoxForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu.Forms 5 | { 6 | public partial class MessageBoxForm : Form 7 | { 8 | public string Message 9 | { 10 | get 11 | { 12 | return txtMessage.Text; 13 | } 14 | set 15 | { 16 | txtMessage.Text = value; 17 | } 18 | } 19 | 20 | public MessageBoxForm() 21 | { 22 | InitializeComponent(); 23 | } 24 | 25 | private void OkClick(object sender, EventArgs e) => Close(); 26 | 27 | private void FormKeyDown(object sender, KeyEventArgs e) 28 | { 29 | if (e.KeyValue == 13 || e.KeyValue == 27) 30 | { 31 | Close(); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SmartContextMenu/Hooks/KeyboardEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Settings; 3 | 4 | namespace SmartContextMenu.Hooks 5 | { 6 | class KeyboardEventArgs : EventArgs 7 | { 8 | public MenuItem MenuItem { get; } 9 | 10 | public WindowSizeMenuItem WindowSizeMenuItem { get; } 11 | 12 | public StartProgramMenuItem StartProgramMenuItem { get; } 13 | 14 | public bool Succeeded { get; set; } 15 | 16 | public KeyboardEventArgs() 17 | { 18 | } 19 | 20 | public KeyboardEventArgs(MenuItem menuItem) 21 | { 22 | MenuItem = menuItem; 23 | } 24 | 25 | public KeyboardEventArgs(WindowSizeMenuItem menuItem) 26 | { 27 | WindowSizeMenuItem = menuItem; 28 | } 29 | 30 | public KeyboardEventArgs(StartProgramMenuItem menuItem) 31 | { 32 | StartProgramMenuItem = menuItem; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Package/Chocolatey/update.ps1: -------------------------------------------------------------------------------- 1 | $releases = 'https://github.com/AlexanderPro/SmartContextMenu/releases' 2 | 3 | function global:au_GetLatest { 4 | $download_page = Invoke-WebRequest -Uri $releases 5 | $regex = '/AlexanderPro/SmartContextMenu/releases/download/.*?/SmartContextMenu_v.*?.zip$' 6 | $url = "https://github.com/" + ($download_page.links | ? href -match $regex | select -First 1 -expand href) 7 | 8 | $verregex= [regex]'/SmartContextMenu_v(.*?).zip$' 9 | $version = $verregex.Match( $url ).Groups[1] 10 | return @{ 11 | Version = $version; 12 | URL32 = $url; 13 | ChecksumType32 = 'sha256' 14 | } 15 | } 16 | 17 | 18 | function global:au_SearchReplace { 19 | @{ 20 | "tools\chocolateyInstall.ps1" = @{ 21 | "(^[$]url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'" #1 22 | "(?i)(^\s*checksum\s*=\s*)'.*'" = "`$1'$($Latest.Checksum32)'" #2 23 | } 24 | } 25 | } 26 | 27 | 28 | update -ChecksumFor 32 -------------------------------------------------------------------------------- /SmartContextMenu/Settings/MenuItems.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using SmartContextMenu.Extensions; 4 | 5 | namespace SmartContextMenu.Settings 6 | { 7 | public class MenuItems 8 | { 9 | public IList WindowSizeItems { get; set; } 10 | 11 | public IList StartProgramItems { get; set; } 12 | 13 | public IList Items { get; set; } 14 | 15 | public MenuItems() 16 | { 17 | WindowSizeItems = new List(); 18 | StartProgramItems = new List(); 19 | Items = new List(); 20 | } 21 | 22 | public string GetHotKeysCombination(string name) 23 | { 24 | var item = Items.Flatten(x => x.Items).Where(x => x.Type == MenuItemType.Item).FirstOrDefault(x => x.Name == name); 25 | var value = item == null ? "" : item.ToString(); 26 | return value; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Alexander Illarionov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SmartContextMenu/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | namespace SmartContextMenu.Properties 13 | { 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 17 | { 18 | 19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 20 | 21 | public static Settings Default 22 | { 23 | get 24 | { 25 | return defaultInstance; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SmartContextMenu/CommandLineParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SmartContextMenu 6 | { 7 | class CommandLineParser 8 | { 9 | private readonly Dictionary toggles; 10 | 11 | public CommandLineParser(string[] args) 12 | { 13 | toggles = 14 | args.Zip(args.Skip(1).Concat(new[] { string.Empty }), (first, second) => new { first, second }) 15 | .Where(pair => IsToggle(pair.first)) 16 | .ToDictionary(pair => RemovePrefix(pair.first).ToLowerInvariant(), g => IsToggle(g.second) ? string.Empty : g.second); 17 | } 18 | 19 | private static string RemovePrefix(string toggle) => new string(toggle.SkipWhile(c => c == '-').ToArray()); 20 | 21 | private static bool IsToggle(string arg) => arg.StartsWith("-", StringComparison.InvariantCulture); 22 | 23 | public bool HasToggle(string toggle) => toggles.ContainsKey(toggle.ToLowerInvariant()); 24 | 25 | public string GetToggleValueOrDefault(string toggle, string defaultValue) => toggles.TryGetValue(toggle.ToLowerInvariant(), out var value) ? value : defaultValue; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SmartContextMenu.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.33529.622 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartContextMenu", "SmartContextMenu\SmartContextMenu.csproj", "{F89152FD-CF01-43DF-B7F4-7374F08A18E8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F89152FD-CF01-43DF-B7F4-7374F08A18E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {F89152FD-CF01-43DF-B7F4-7374F08A18E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {F89152FD-CF01-43DF-B7F4-7374F08A18E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {F89152FD-CF01-43DF-B7F4-7374F08A18E8}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {5AFD66E0-8977-405F-9E51-ABDC5B036611} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /SmartContextMenu/AutoStarter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Win32; 2 | 3 | namespace SmartContextMenu 4 | { 5 | static class AutoStarter 6 | { 7 | private const string RUN_LOCATION = @"Software\Microsoft\Windows\CurrentVersion\Run"; 8 | 9 | public static void Enable(string keyName, string assemblyLocation) 10 | { 11 | using var key = Registry.CurrentUser.CreateSubKey(RUN_LOCATION); 12 | key.SetValue(keyName, assemblyLocation); 13 | } 14 | 15 | public static void Disable(string keyName) 16 | { 17 | using var key = Registry.CurrentUser.CreateSubKey(RUN_LOCATION); 18 | key.DeleteValue(keyName); 19 | } 20 | 21 | public static bool IsEnabled(string keyName, string assemblyLocation) 22 | { 23 | using var key = Registry.CurrentUser.OpenSubKey(RUN_LOCATION); 24 | if (key == null) 25 | { 26 | return false; 27 | } 28 | var value = (string)key.GetValue(keyName); 29 | if (string.IsNullOrEmpty(value)) 30 | { 31 | return false; 32 | } 33 | return (value == assemblyLocation); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/DimForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using SmartContextMenu.Native.Enums; 5 | using static SmartContextMenu.Native.User32; 6 | using static SmartContextMenu.Native.Constants; 7 | 8 | namespace SmartContextMenu.Forms 9 | { 10 | public partial class DimForm : Form 11 | { 12 | public DimForm(Color backColor, double opacity) 13 | { 14 | InitializeComponent(); 15 | 16 | SetStyle(ControlStyles.SupportsTransparentBackColor, true); 17 | StartPosition = FormStartPosition.Manual; 18 | FormBorderStyle = FormBorderStyle.None; 19 | ShowInTaskbar = false; 20 | ControlBox = false; 21 | BackColor = backColor; 22 | Opacity = opacity; 23 | Width = 1; 24 | Height = 1; 25 | } 26 | 27 | protected override void OnLoad(EventArgs e) 28 | { 29 | base.OnLoad(e); 30 | 31 | var exStyle = GetWindowLong(Handle, GWL_EXSTYLE); 32 | SetWindowLong(Handle, GWL_EXSTYLE, exStyle | WS_EX_NOACTIVATE); 33 | ShowWindow(Handle, (int)WindowShowStyle.ShowMaximized); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SmartContextMenu/ContextMenuItemValue.cs: -------------------------------------------------------------------------------- 1 | using SmartContextMenu.Settings; 2 | 3 | namespace SmartContextMenu 4 | { 5 | class ContextMenuItemValue 6 | { 7 | public Window Window { get; set; } 8 | 9 | public MenuItem MenuItem { get; } 10 | 11 | public WindowSizeMenuItem WindowSizeMenuItem { get; } 12 | 13 | public MoveToMenuItem MoveToMenuItem { get; } 14 | 15 | public StartProgramMenuItem StartProgramMenuItem { get; } 16 | 17 | 18 | public ContextMenuItemValue(Window window, MenuItem menuItem) 19 | { 20 | Window = window; 21 | MenuItem = menuItem; 22 | } 23 | 24 | public ContextMenuItemValue(Window window, WindowSizeMenuItem windowSizeMenuItem) 25 | { 26 | Window = window; 27 | WindowSizeMenuItem = windowSizeMenuItem; 28 | } 29 | 30 | public ContextMenuItemValue(Window window, MoveToMenuItem moveToMenuItem) 31 | { 32 | Window = window; 33 | MoveToMenuItem = moveToMenuItem; 34 | } 35 | 36 | public ContextMenuItemValue(Window window, StartProgramMenuItem startProgramMenuItem) 37 | { 38 | Window = window; 39 | StartProgramMenuItem = startProgramMenuItem; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/AboutForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using SmartContextMenu.Utils; 4 | 5 | namespace SmartContextMenu.Forms 6 | { 7 | partial class AboutForm : Form 8 | { 9 | private const string URL_SMART_CONTEXT_MENU = "https://github.com/AlexanderPro/SmartContextMenu"; 10 | 11 | public AboutForm(LanguageManager manager) 12 | { 13 | InitializeComponent(); 14 | btnOk.Text = manager.GetString("about_btn_ok"); 15 | Text = manager.GetString("about_form") + AssemblyUtils.AssemblyProductName; 16 | lblProductName.Text = $"{AssemblyUtils.AssemblyProductName} v{AssemblyUtils.AssemblyProductVersion}"; 17 | lblCopyright.Text = $"{AssemblyUtils.AssemblyCopyright}-{DateTime.Now.Year} {AssemblyUtils.AssemblyCompany}"; 18 | linkUrl.Text = URL_SMART_CONTEXT_MENU; 19 | } 20 | 21 | private void ButtonOkClick(object sender, EventArgs e) => Close(); 22 | 23 | private void LinkClick(object sender, EventArgs e) => SystemUtils.RunAs(SystemUtils.GetDefaultBrowserModuleName(), URL_SMART_CONTEXT_MENU, true); 24 | 25 | private void KeyDownClick(object sender, KeyEventArgs e) 26 | { 27 | if (e.KeyValue == 13 || e.KeyValue == 27) 28 | { 29 | Close(); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/ParameterForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu.Forms 5 | { 6 | partial class ParameterForm : Form 7 | { 8 | public string ParameterValue { get; private set; } 9 | 10 | public ParameterForm(LanguageManager manager, string parameter) 11 | { 12 | InitializeComponent(); 13 | InitializeControls(manager, parameter); 14 | } 15 | 16 | private void InitializeControls(LanguageManager manager, string parameter) 17 | { 18 | lblParameter.Text = parameter; 19 | btnApply.Text = manager.GetString("parameter_btn_apply"); 20 | Text = manager.GetString("parameter_form"); 21 | DialogResult = DialogResult.Cancel; 22 | } 23 | 24 | private void ButtonApplyClick(object sender, EventArgs e) 25 | { 26 | ParameterValue = txtParameterValue.Text; 27 | DialogResult = DialogResult.OK; 28 | Close(); 29 | } 30 | 31 | private void FormKeyDown(object sender, KeyEventArgs e) 32 | { 33 | if (e.KeyValue == 13) 34 | { 35 | ButtonApplyClick(sender, e); 36 | } 37 | 38 | if (e.KeyValue == 27) 39 | { 40 | Close(); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SmartContextMenu/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("SmartContextMenu")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Alexander Illarionov")] 11 | [assembly: AssemblyProduct("SmartContextMenu")] 12 | [assembly: AssemblyCopyright("Copyright © 2024")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("f89152fd-cf01-43df-b7f4-7374f08a18e8")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.7.2")] 35 | [assembly: AssemblyFileVersion("1.7.2")] 36 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/DimForm.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace SmartContextMenu.Forms 3 | { 4 | partial class DimForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.SuspendLayout(); 33 | // 34 | // DimForm 35 | // 36 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 37 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 38 | this.ClientSize = new System.Drawing.Size(800, 450); 39 | this.Name = "DimForm"; 40 | this.Text = "DimForm"; 41 | this.ResumeLayout(false); 42 | 43 | } 44 | 45 | #endregion 46 | } 47 | } -------------------------------------------------------------------------------- /SmartContextMenu/Forms/TitleForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu.Forms 5 | { 6 | partial class TitleForm : Form 7 | { 8 | public string Title 9 | { 10 | get 11 | { 12 | return txtTitle.Text; 13 | } 14 | set 15 | { 16 | txtTitle.Text = value; 17 | } 18 | } 19 | 20 | public TitleForm(LanguageManager manager) 21 | { 22 | InitializeComponent(); 23 | InitializeControls(manager); 24 | } 25 | 26 | protected override void OnLoad(EventArgs e) 27 | { 28 | base.OnLoad(e); 29 | txtTitle.Focus(); 30 | } 31 | 32 | private void InitializeControls(LanguageManager manager) 33 | { 34 | btnApply.Text = manager.GetString("change_title_btn_apply"); 35 | btnCancel.Text = manager.GetString("change_title_btn_cancel"); 36 | Text = manager.GetString("change_title_form"); 37 | } 38 | 39 | private void ButtonApplyClick(object sender, EventArgs e) 40 | { 41 | DialogResult = DialogResult.OK; 42 | Close(); 43 | } 44 | 45 | private void ButtonCancelClick(object sender, EventArgs e) 46 | { 47 | DialogResult = DialogResult.Cancel; 48 | Close(); 49 | } 50 | 51 | private void FormKeyDown(object sender, KeyEventArgs e) 52 | { 53 | if (e.KeyValue == 27) 54 | { 55 | ButtonCancelClick(sender, e); 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /SmartContextMenu/Forms/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace SmartContextMenu.Forms 3 | { 4 | partial class MainForm 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 33 | this.SuspendLayout(); 34 | // 35 | // MainForm 36 | // 37 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 38 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 39 | this.ClientSize = new System.Drawing.Size(268, 0); 40 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 41 | this.Name = "MainForm"; 42 | this.Text = "SmartContextMenu"; 43 | this.ResumeLayout(false); 44 | 45 | } 46 | 47 | #endregion 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /SmartContextMenu/LanguageManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Generic; 4 | using System.Reflection; 5 | using System.Xml.Linq; 6 | using System.Xml.XPath; 7 | 8 | namespace SmartContextMenu 9 | { 10 | public class LanguageManager 11 | { 12 | private readonly static Dictionary> _values = Parse(); 13 | private readonly string _languageName; 14 | 15 | public LanguageManager(string languageName) 16 | { 17 | _languageName = languageName; 18 | } 19 | 20 | public string GetString(string name) => _values.TryGetValue(_languageName, out var dictionary) && dictionary.TryGetValue(name, out var value) ? value : string.Empty; 21 | 22 | private static Dictionary> Parse() 23 | { 24 | var values = new Dictionary>(StringComparer.OrdinalIgnoreCase); 25 | using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SmartContextMenu.Language.xml"); 26 | var document = XDocument.Load(stream); 27 | foreach (var languageElement in document.XPathSelectElements($"//languages/language")) 28 | { 29 | var languageValues = languageElement 30 | .XPathSelectElements($"./item") 31 | .Select(x => new 32 | { 33 | Name = x.Attribute("name") != null ? x.Attribute("name").Value : string.Empty, 34 | Value = x.Attribute("value") != null ? x.Attribute("value").Value : string.Empty, 35 | }) 36 | .ToDictionary(x => x.Name, y => y.Value, StringComparer.OrdinalIgnoreCase); 37 | 38 | values.Add(languageElement.Attribute("name").Value, languageValues); 39 | } 40 | 41 | return values; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SmartContextMenu/Settings/WindowSizeMenuItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Extensions; 3 | using SmartContextMenu.Hooks; 4 | 5 | namespace SmartContextMenu.Settings 6 | { 7 | public class WindowSizeMenuItem : ICloneable 8 | { 9 | public string Title { get; set; } 10 | 11 | public int? Left { get; set; } 12 | 13 | public int? Top { get; set; } 14 | 15 | public int? Width { get; set; } 16 | 17 | public int? Height { get; set; } 18 | 19 | public VirtualKeyModifier Key1 { get; set; } 20 | 21 | public VirtualKeyModifier Key2 { get; set; } 22 | 23 | public VirtualKey Key3 { get; set; } 24 | 25 | public WindowSizeMenuItem() 26 | { 27 | Title = string.Empty; 28 | Left = null; 29 | Top = null; 30 | Width = null; 31 | Height = null; 32 | Key1 = VirtualKeyModifier.None; 33 | Key2 = VirtualKeyModifier.None; 34 | Key3 = VirtualKey.None; 35 | } 36 | 37 | public object Clone() => MemberwiseClone(); 38 | 39 | public override string ToString() 40 | { 41 | var combination = string.Empty; 42 | 43 | if (Key1 != VirtualKeyModifier.None) 44 | { 45 | combination = Key1.GetDescription(); 46 | } 47 | 48 | if (Key2 != VirtualKeyModifier.None) 49 | { 50 | combination += string.IsNullOrEmpty(combination) ? Key2.GetDescription() : "+" + Key2.GetDescription(); 51 | } 52 | 53 | if (Key3 != VirtualKey.None) 54 | { 55 | combination += string.IsNullOrEmpty(combination) ? Key3.GetDescription() : "+" + Key3.GetDescription(); 56 | } 57 | else 58 | { 59 | combination = string.Empty; 60 | } 61 | 62 | return combination; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Enums/CopyPixelOperations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SmartContextMenu.Native.Enums 4 | { 5 | [Flags] 6 | public enum CopyPixelOperations 7 | { 8 | NoMirrorBitmap = -2147483648, 9 | 10 | /// dest = BLACK, 0x00000042 11 | Blackness = 66, 12 | 13 | ///dest = (NOT src) AND (NOT dest), 0x001100A6 14 | NotSourceErase = 1114278, 15 | 16 | ///dest = (NOT source), 0x00330008 17 | NotSourceCopy = 3342344, 18 | 19 | ///dest = source AND (NOT dest), 0x00440328 20 | SourceErase = 4457256, 21 | 22 | /// dest = (NOT dest), 0x00550009 23 | DestinationInvert = 5570569, 24 | 25 | /// dest = pattern XOR dest, 0x005A0049 26 | PatInvert = 5898313, 27 | 28 | ///dest = source XOR dest, 0x00660046 29 | SourceInvert = 6684742, 30 | 31 | ///dest = source AND dest, 0x008800C6 32 | SourceAnd = 8913094, 33 | 34 | /// dest = (NOT source) OR dest, 0x00BB0226 35 | MergePaint = 12255782, 36 | 37 | ///dest = (source AND pattern), 0x00C000CA 38 | MergeCopy = 12583114, 39 | 40 | ///dest = source, 0x00CC0020 41 | SourceCopy = 13369376, 42 | 43 | /// dest = source OR dest, 0x00EE0086 44 | SourcePaint = 15597702, 45 | 46 | /// dest = pattern, 0x00F00021 47 | PatCopy = 15728673, 48 | 49 | /// dest = DPSnoo, 0x00FB0A09 50 | PatPaint = 16452105, 51 | 52 | /// dest = WHITE, 0x00FF0062 53 | Whiteness = 16711778, 54 | 55 | /// 56 | /// Capture window as seen on screen. This includes layered windows 57 | /// such as WPF windows with AllowsTransparency="true", 0x40000000 58 | /// 59 | CaptureBlt = 1073741824, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/PositionForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu.Forms 5 | { 6 | partial class PositionForm : Form 7 | { 8 | public int WindowLeft { get; private set; } 9 | 10 | public int WindowTop { get; private set; } 11 | 12 | public PositionForm(LanguageManager manager, Window window) 13 | { 14 | InitializeComponent(); 15 | InitializeControls(manager, window); 16 | } 17 | 18 | private void InitializeControls(LanguageManager manager, Window window) 19 | { 20 | lblLeft.Text = manager.GetString("lbl_left"); 21 | lblTop.Text = manager.GetString("lbl_top"); 22 | btnApply.Text = manager.GetString("align_btn_apply"); 23 | Text = manager.GetString("align_form"); 24 | 25 | var left = window.Size.Left; 26 | var top = window.Size.Top; 27 | 28 | WindowLeft = left; 29 | WindowTop = top; 30 | 31 | txtLeft.Text = left.ToString(); 32 | txtTop.Text = top.ToString(); 33 | 34 | DialogResult = DialogResult.Cancel; 35 | } 36 | 37 | private void ButtonApplyClick(object sender, EventArgs e) 38 | { 39 | if (!int.TryParse(txtLeft.Text, out var left)) 40 | { 41 | txtLeft.SelectAll(); 42 | txtLeft.Focus(); 43 | return; 44 | } 45 | 46 | if (!int.TryParse(txtTop.Text, out var top)) 47 | { 48 | txtTop.SelectAll(); 49 | txtTop.Focus(); 50 | return; 51 | } 52 | 53 | WindowLeft = left; 54 | WindowTop = top; 55 | 56 | DialogResult = DialogResult.OK; 57 | Close(); 58 | } 59 | 60 | private void FormKeyDown(object sender, KeyEventArgs e) 61 | { 62 | if (e.KeyValue == 13) 63 | { 64 | ButtonApplyClick(sender, e); 65 | } 66 | 67 | if (e.KeyValue == 27) 68 | { 69 | Close(); 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /SmartContextMenu/Settings/MenuItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SmartContextMenu.Extensions; 4 | using SmartContextMenu.Hooks; 5 | 6 | namespace SmartContextMenu.Settings 7 | { 8 | public class MenuItem : ICloneable 9 | { 10 | public MenuItemType Type { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public bool Show { get; set; } 15 | 16 | public VirtualKeyModifier Key1 { get; set; } 17 | 18 | public VirtualKeyModifier Key2 { get; set; } 19 | 20 | public VirtualKey Key3 { get; set; } 21 | 22 | public IList Items { get; set; } 23 | 24 | public MenuItem() 25 | { 26 | Type = MenuItemType.Item; 27 | Name = string.Empty; 28 | Show = true; 29 | Key1 = VirtualKeyModifier.None; 30 | Key2 = VirtualKeyModifier.None; 31 | Key3 = VirtualKey.None; 32 | Items = new List(); 33 | } 34 | 35 | public object Clone() 36 | { 37 | var menuItemClone = (MenuItem)MemberwiseClone(); 38 | menuItemClone.Items = new List(); 39 | foreach (var item in Items) 40 | { 41 | menuItemClone.Items.Add((MenuItem)item.Clone()); 42 | } 43 | return menuItemClone; 44 | } 45 | 46 | public override string ToString() 47 | { 48 | var combination = string.Empty; 49 | 50 | if (Key1 != VirtualKeyModifier.None) 51 | { 52 | combination = Key1.GetDescription(); 53 | } 54 | 55 | if (Key2 != VirtualKeyModifier.None) 56 | { 57 | combination += string.IsNullOrEmpty(combination) ? Key2.GetDescription() : "+" + Key2.GetDescription(); 58 | } 59 | 60 | if (Key3 != VirtualKey.None) 61 | { 62 | combination += string.IsNullOrEmpty(combination) ? Key3.GetDescription() : "+" + Key3.GetDescription(); 63 | } 64 | else 65 | { 66 | combination = string.Empty; 67 | } 68 | 69 | return combination; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /SmartContextMenu/Native/Gdi32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using SmartContextMenu.Native.Enums; 4 | 5 | namespace SmartContextMenu.Native 6 | { 7 | static class Gdi32 8 | { 9 | [DllImport("gdi32.dll", EntryPoint = "CreateCompatibleDC", SetLastError = true)] 10 | public static extern IntPtr CreateCompatibleDC([In] IntPtr hdc); 11 | 12 | [DllImport("gdi32.dll", EntryPoint = "SelectObject")] 13 | public static extern IntPtr SelectObject([In] IntPtr hdc, [In] IntPtr hgdiobj); 14 | 15 | [DllImport("gdi32.dll", EntryPoint = "BitBlt", SetLastError = true)] 16 | [return: MarshalAs(UnmanagedType.Bool)] 17 | public static extern bool BitBlt([In] IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, [In] IntPtr hdcSrc, int nXSrc, int nYSrc, CopyPixelOperations dwRop); 18 | 19 | [DllImport("gdi32.dll", EntryPoint = "StretchBlt", SetLastError = true)] 20 | [return: MarshalAs(UnmanagedType.Bool)] 21 | public static extern bool StretchBlt([In] IntPtr hdc, int nXDest, int nYDest, int nWidthDest, int nHeightDest, [In] IntPtr hdcSrc, int nXSrc, int nYSrc, int nWidthSource, int nHeightSource, CopyPixelOperations dwRop); 22 | 23 | [DllImport("gdi32.dll")] 24 | public static extern IntPtr CreateDIBSection(IntPtr hdc, [In] ref IntPtr pbmi, uint pila, out IntPtr ppvBits, IntPtr hSection, uint dwOffset); 25 | 26 | [DllImport("gdi32.dll", EntryPoint = "DeleteDC")] 27 | public static extern bool DeleteDC([In] IntPtr hdc); 28 | 29 | [DllImport("gdi32.dll")] 30 | public static extern int GetObject(IntPtr hgdiobj, int cbBuffer, IntPtr lpvObject); 31 | 32 | [DllImport("gdi32.dll", EntryPoint = "DeleteObject")] 33 | [return: MarshalAs(UnmanagedType.Bool)] 34 | public static extern bool DeleteObject([In] IntPtr hObject); 35 | 36 | [DllImport("gdi32.dll")] 37 | public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight); 38 | 39 | [DllImport("gdi32.dll")] 40 | internal static extern int GetDeviceCaps(IntPtr hdc, int capindex); 41 | 42 | [DllImport("gdi32.dll")] 43 | internal static extern bool PatBlt(IntPtr hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, uint dwRop); 44 | } 45 | } -------------------------------------------------------------------------------- /SmartContextMenu/Settings/StartProgramMenuItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Extensions; 3 | using SmartContextMenu.Hooks; 4 | 5 | namespace SmartContextMenu.Settings 6 | { 7 | public class StartProgramMenuItem : ICloneable 8 | { 9 | public const string PARAMETER_PROCESS_ID = "process_id"; 10 | public const string PARAMETER_PROCESS_NAME = "process_name"; 11 | public const string PARAMETER_WINDOW_TITLE = "window_title"; 12 | 13 | public string Title { get; set; } 14 | 15 | public string FileName { get; set; } 16 | 17 | public string Arguments { get; set; } 18 | 19 | public bool UseWindowWorkingDirectory { get; set; } 20 | 21 | public bool ShowWindow { get; set; } 22 | 23 | public string BeginParameter { get; set; } 24 | 25 | public string EndParameter { get; set; } 26 | 27 | public VirtualKeyModifier Key1 { get; set; } 28 | 29 | public VirtualKeyModifier Key2 { get; set; } 30 | 31 | public VirtualKey Key3 { get; set; } 32 | 33 | public StartProgramMenuItem() 34 | { 35 | Title = string.Empty; 36 | FileName = string.Empty; 37 | Arguments = string.Empty; 38 | UseWindowWorkingDirectory = false; 39 | ShowWindow = true; 40 | BeginParameter = string.Empty; 41 | EndParameter = string.Empty; 42 | Key1 = VirtualKeyModifier.None; 43 | Key2 = VirtualKeyModifier.None; 44 | Key3 = VirtualKey.None; 45 | } 46 | 47 | public object Clone() => MemberwiseClone(); 48 | 49 | public override string ToString() 50 | { 51 | var combination = string.Empty; 52 | 53 | if (Key1 != VirtualKeyModifier.None) 54 | { 55 | combination = Key1.GetDescription(); 56 | } 57 | 58 | if (Key2 != VirtualKeyModifier.None) 59 | { 60 | combination += string.IsNullOrEmpty(combination) ? Key2.GetDescription() : "+" + Key2.GetDescription(); 61 | } 62 | 63 | if (Key3 != VirtualKey.None) 64 | { 65 | combination += string.IsNullOrEmpty(combination) ? Key3.GetDescription() : "+" + Key3.GetDescription(); 66 | } 67 | else 68 | { 69 | combination = string.Empty; 70 | } 71 | 72 | return combination; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SmartContextMenu.Extensions 5 | { 6 | static class StringExtensions 7 | { 8 | public static IList GetParams(this string value, string begin, string end) 9 | { 10 | var result = new List(); 11 | 12 | if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(begin) || string.IsNullOrEmpty(end)) 13 | { 14 | return result; 15 | } 16 | 17 | var startIndex = 0; 18 | int beginIndex; 19 | while ((beginIndex = value.IndexOf(begin, startIndex, StringComparison.Ordinal)) >= 0) 20 | { 21 | if (beginIndex < 0) 22 | { 23 | break; 24 | } 25 | 26 | startIndex = beginIndex + 1; 27 | var endIndex = value.IndexOf(end, startIndex, StringComparison.Ordinal); 28 | 29 | if (endIndex < 0 || startIndex >= endIndex) 30 | { 31 | break; 32 | } 33 | 34 | var parameter = value.Substring(beginIndex, endIndex - beginIndex + 1); 35 | if (!string.IsNullOrEmpty(parameter) && !result.Contains(parameter)) 36 | { 37 | result.Add(parameter); 38 | } 39 | 40 | startIndex = endIndex + 1; 41 | } 42 | return result; 43 | } 44 | 45 | public static string TrimStart(this string value, string trimString) 46 | { 47 | if (string.IsNullOrEmpty(trimString)) 48 | { 49 | return value; 50 | } 51 | 52 | var result = value; 53 | while (result.StartsWith(trimString)) 54 | { 55 | result = result.Substring(trimString.Length); 56 | } 57 | 58 | return result; 59 | } 60 | 61 | public static string TrimEnd(this string value, string trimString) 62 | { 63 | if (string.IsNullOrEmpty(trimString)) 64 | { 65 | return value; 66 | } 67 | 68 | var result = value; 69 | while (result.EndsWith(trimString)) 70 | { 71 | result = result.Substring(0, result.Length - trimString.Length); 72 | } 73 | 74 | return result; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /SmartContextMenu/Forms/SizeForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SmartContextMenu.Forms 5 | { 6 | partial class SizeForm : Form 7 | { 8 | public int? WindowLeft { get; private set; } 9 | 10 | public int? WindowTop { get; private set; } 11 | 12 | public int? WindowWidth { get; private set; } 13 | 14 | public int? WindowHeight { get; private set; } 15 | 16 | public SizeForm(LanguageManager manager, Window window) 17 | { 18 | InitializeComponent(); 19 | InitializeControls(manager, window); 20 | } 21 | 22 | private void InitializeControls(LanguageManager manager, Window window) 23 | { 24 | lblLeft.Text = manager.GetString("lbl_size_form_left"); 25 | lblTop.Text = manager.GetString("lbl_size_form_top"); 26 | lblWidth.Text = manager.GetString("lbl_size_form_width"); 27 | lblHeight.Text = manager.GetString("lbl_size_form_height"); 28 | btnApply.Text = manager.GetString("size_btn_apply"); 29 | Text = manager.GetString("size_form"); 30 | 31 | var size = window.Size; 32 | 33 | WindowLeft = size.Left; 34 | WindowTop = size.Top; 35 | WindowWidth = size.Width; 36 | WindowHeight = size.Height; 37 | 38 | txtLeft.Text = size.Left.ToString(); 39 | txtTop.Text = size.Top.ToString(); 40 | txtWidth.Text = size.Width.ToString(); 41 | txtHeight.Text = size.Height.ToString(); 42 | 43 | DialogResult = DialogResult.Cancel; 44 | } 45 | 46 | private void ButtonApplyClick(object sender, EventArgs e) 47 | { 48 | WindowLeft = int.TryParse(txtLeft.Text, out var left) ? left : null; 49 | WindowTop = int.TryParse(txtTop.Text, out var top) ? top : null; 50 | WindowWidth = int.TryParse(txtWidth.Text, out var width) ? width : null; 51 | WindowHeight = int.TryParse(txtHeight.Text, out var height) ? height : null; 52 | DialogResult = DialogResult.OK; 53 | Close(); 54 | } 55 | 56 | private void FormKeyDown(object sender, KeyEventArgs e) 57 | { 58 | if (e.KeyValue == 13) 59 | { 60 | ButtonApplyClick(sender, e); 61 | } 62 | 63 | if (e.KeyValue == 27) 64 | { 65 | Close(); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SmartContextMenu/Utils/AssemblyUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.IO; 3 | using System.Linq; 4 | 5 | namespace SmartContextMenu.Utils 6 | { 7 | static class AssemblyUtils 8 | { 9 | public static string AssemblyLocation => Assembly.GetExecutingAssembly().Location; 10 | 11 | public static string AssemblyDirectory => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 12 | 13 | public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString(); 14 | 15 | public static string AssemblyTitle => Assembly 16 | .GetExecutingAssembly() 17 | .GetCustomAttributes(typeof(AssemblyTitleAttribute), false) 18 | .OfType() 19 | .FirstOrDefault()?.Title ?? string.Empty; 20 | 21 | public static string AssemblyProductName => Assembly 22 | .GetExecutingAssembly() 23 | .GetCustomAttributes(typeof(AssemblyProductAttribute), false) 24 | .OfType() 25 | .FirstOrDefault()?.Product ?? string.Empty; 26 | 27 | public static string AssemblyCopyright => Assembly 28 | .GetExecutingAssembly() 29 | .GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false) 30 | .OfType() 31 | .FirstOrDefault()?.Copyright ?? string.Empty; 32 | 33 | public static string AssemblyCompany => Assembly 34 | .GetExecutingAssembly() 35 | .GetCustomAttributes(typeof(AssemblyCompanyAttribute), false) 36 | .OfType() 37 | .FirstOrDefault()?.Company ?? string.Empty; 38 | 39 | public static string AssemblyProductVersion 40 | { 41 | get 42 | { 43 | var version = Assembly.GetExecutingAssembly().GetName().Version; 44 | return $"{version.Major}.{version.Minor}.{version.Build}"; 45 | } 46 | } 47 | 48 | public static void ExtractFileFromAssembly(string resourceName, string path) 49 | { 50 | var currentAssembly = Assembly.GetExecutingAssembly(); 51 | var outputFileStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); 52 | var resouceStream = currentAssembly.GetManifestResourceStream(resourceName); 53 | resouceStream.CopyTo(outputFileStream); 54 | resouceStream.Close(); 55 | outputFileStream.Close(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/TransparencyForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using SmartContextMenu.Native; 4 | 5 | namespace SmartContextMenu.Forms 6 | { 7 | partial class TransparencyForm : Form 8 | { 9 | private Window _window; 10 | 11 | public int WindowTransparency { get; private set; } 12 | 13 | public TransparencyForm(LanguageManager manager, Window window) 14 | { 15 | InitializeComponent(); 16 | InitializeControls(manager, window); 17 | } 18 | 19 | protected override void WndProc(ref Message m) 20 | { 21 | if (m.Msg == Constants.WM_SYSCOMMAND) 22 | { 23 | var lowOrder = m.WParam.ToInt64() & 0x0000FFFF; 24 | if (lowOrder == Constants.SC_CLOSE) 25 | { 26 | ButtonCancelClick(this, EventArgs.Empty); 27 | } 28 | } 29 | 30 | base.WndProc(ref m); 31 | } 32 | 33 | 34 | private void InitializeControls(LanguageManager manager, Window window) 35 | { 36 | _window = window; 37 | btnApply.Text = manager.GetString("trans_btn_apply"); 38 | Text = manager.GetString("trans_form"); 39 | WindowTransparency = window.Transparency; 40 | numericTransparency.Value = WindowTransparency; 41 | DialogResult = DialogResult.Cancel; 42 | numericTransparency.TextChanged += NumericTransparencyValueChanged; 43 | } 44 | 45 | private void NumericTransparencyValueChanged(object sender, EventArgs e) 46 | { 47 | _window.SetTransparency((int)numericTransparency.Value); 48 | } 49 | 50 | private void ButtonApplyClick(object sender, EventArgs e) 51 | { 52 | WindowTransparency = (int)numericTransparency.Value; 53 | DialogResult = DialogResult.OK; 54 | Close(); 55 | } 56 | 57 | private void ButtonCancelClick(object sender, EventArgs e) 58 | { 59 | if (WindowTransparency != _window.Transparency) 60 | { 61 | _window.SetTransparency(WindowTransparency); 62 | } 63 | DialogResult = DialogResult.Cancel; 64 | Close(); 65 | } 66 | 67 | private void FormKeyDown(object sender, KeyEventArgs e) 68 | { 69 | if (e.KeyValue == 13) 70 | { 71 | ButtonApplyClick(sender, e); 72 | } 73 | 74 | if (e.KeyValue == 27) 75 | { 76 | ButtonCancelClick(sender, e); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Kernel32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Runtime.InteropServices; 4 | using SmartContextMenu.Native.Enums; 5 | using SmartContextMenu.Native.Structs; 6 | 7 | namespace SmartContextMenu.Native 8 | { 9 | static class Kernel32 10 | { 11 | [DllImport("kernel32.dll")] 12 | public static extern bool SetPriorityClass(IntPtr hProcess, PriorityClass priorityClass); 13 | 14 | [DllImport("kernel32.dll")] 15 | public static extern PriorityClass GetPriorityClass(IntPtr hProcess); 16 | 17 | [DllImport("kernel32.dll")] 18 | public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId); 19 | 20 | [DllImport("kernel32.dll")] 21 | public static extern bool CloseHandle(IntPtr hObject); 22 | 23 | [DllImport("kernel32.dll")] 24 | public static extern uint GetCurrentThreadId(); 25 | 26 | [DllImport("kernel32.dll", SetLastError = true)] 27 | public static extern bool AttachConsole(int processID); 28 | 29 | [DllImport("kernel32.dll", SetLastError = true)] 30 | public static extern uint GetConsoleOutputCP(); 31 | 32 | [DllImport("kernel32.dll")] 33 | public static extern bool FreeConsole(); 34 | 35 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] 36 | public static extern bool ReadConsoleOutputCharacter(IntPtr hConsoleOutput, [Out] char[] lpCharacter, uint nLength, Coord dwReadCoord, out uint lpNumberOfCharsRead); 37 | 38 | [DllImport("kernel32.dll", SetLastError = true)] 39 | public static extern bool GetConsoleScreenBufferInfo(IntPtr hConsoleOutput, out ConsoleScreenBufferInfo lpConsoleScreenBufferInfo); 40 | 41 | [DllImport("kernel32.dll", SetLastError = true)] 42 | public static extern IntPtr GetStdHandle(int nStdHandle); 43 | 44 | [DllImport("kernel32.dll")] 45 | public static extern bool QueryFullProcessImageName([In] IntPtr hProcess, [In] uint dwFlags, [Out] StringBuilder lpExeName, [In, Out] ref uint lpdwSize); 46 | 47 | [DllImport("kernel32.dll")] 48 | public static extern IntPtr GetCurrentProcess(); 49 | 50 | [DllImport("kernel32.dll")] 51 | public static extern IntPtr OpenProcess(ProcessAccess processAccess, bool bInheritHandle, int processId); 52 | 53 | [DllImport("kernel32.dll")] 54 | [return: MarshalAs(UnmanagedType.Bool)] 55 | public static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode); 56 | 57 | [DllImport("kernel32.dll")] 58 | public static extern IntPtr GetModuleHandle(string name); 59 | 60 | [DllImport("kernel32.dll")] 61 | public static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId); 62 | 63 | [DllImport("kernel32.dll")] 64 | public static extern uint SuspendThread(IntPtr hThread); 65 | 66 | [DllImport("kernel32.dll")] 67 | public static extern int ResumeThread(IntPtr hThread); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | [Rr]elease32/ 14 | [Rr]elease64/ 15 | x64/ 16 | build/ 17 | [Bb]in/ 18 | [Oo]bj/ 19 | .vs/ 20 | Application/ 21 | 22 | #NuGet 23 | packages/ 24 | 25 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 26 | !packages/*/build/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | *_i.c 33 | *_p.c 34 | *.ilk 35 | *.meta 36 | *.obj 37 | *.pch 38 | *.pdb 39 | *.pgc 40 | *.pgd 41 | *.rsp 42 | *.sbr 43 | *.tlb 44 | *.tli 45 | *.tlh 46 | *.tmp 47 | *.tmp_proj 48 | *.log 49 | *.vspscc 50 | *.vssscc 51 | .builds 52 | *.pidb 53 | *.log 54 | *.scc 55 | 56 | # Visual C++ cache files 57 | ipch/ 58 | *.aps 59 | *.ncb 60 | *.opensdf 61 | *.sdf 62 | *.cachefile 63 | 64 | # Visual Studio profiler 65 | *.psess 66 | *.vsp 67 | *.vspx 68 | 69 | # Guidance Automation Toolkit 70 | *.gpState 71 | 72 | # ReSharper is a .NET coding add-in 73 | _ReSharper*/ 74 | *.[Rr]e[Ss]harper 75 | 76 | # TeamCity is a build add-in 77 | _TeamCity* 78 | 79 | # DotCover is a Code Coverage Tool 80 | *.dotCover 81 | 82 | # NCrunch 83 | *.ncrunch* 84 | .*crunch*.local.xml 85 | 86 | # Installshield output folder 87 | [Ee]xpress/ 88 | 89 | # DocProject is a documentation generator add-in 90 | DocProject/buildhelp/ 91 | DocProject/Help/*.HxT 92 | DocProject/Help/*.HxC 93 | DocProject/Help/*.hhc 94 | DocProject/Help/*.hhk 95 | DocProject/Help/*.hhp 96 | DocProject/Help/Html2 97 | DocProject/Help/html 98 | 99 | # Click-Once directory 100 | publish/ 101 | 102 | # Publish Web Output 103 | *.Publish.xml 104 | 105 | # NuGet Packages Directory 106 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 107 | #packages/ 108 | 109 | # Windows Azure Build Output 110 | csx 111 | *.build.csdef 112 | 113 | # Windows Store app package directory 114 | AppPackages/ 115 | 116 | # Others 117 | sql/ 118 | *.Cache 119 | ClientBin/ 120 | [Ss]tyle[Cc]op.* 121 | ~$* 122 | *~ 123 | *.dbmdl 124 | *.[Pp]ublish.xml 125 | *.pfx 126 | *.publishsettings 127 | 128 | # RIA/Silverlight projects 129 | Generated_Code/ 130 | 131 | # Backup & report files from converting an old project file to a newer 132 | # Visual Studio version. Backup files are not needed, because we have git ;-) 133 | _UpgradeReport_Files/ 134 | Backup*/ 135 | UpgradeLog*.XML 136 | UpgradeLog*.htm 137 | 138 | # SQL Server files 139 | App_Data/*.mdf 140 | App_Data/*.ldf 141 | 142 | 143 | #LightSwitch generated files 144 | GeneratedArtifacts/ 145 | _Pvt_Extensions/ 146 | ModelManifest.xml 147 | 148 | # ========================= 149 | # Windows detritus 150 | # ========================= 151 | 152 | # Windows image file caches 153 | Thumbs.db 154 | ehthumbs.db 155 | 156 | # Folder config file 157 | Desktop.ini 158 | 159 | # Recycle Bin used on file shares 160 | $RECYCLE.BIN/ 161 | 162 | # Mac desktop service store files 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/HotkeysForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using SmartContextMenu.Hooks; 6 | using SmartContextMenu.Extensions; 7 | using SmartContextMenu.Settings; 8 | 9 | namespace SmartContextMenu.Forms 10 | { 11 | public partial class HotkeysForm : Form 12 | { 13 | public Settings.MenuItem MenuItem { get; private set; } 14 | 15 | public HotkeysForm(LanguageManager manager, Settings.MenuItem menuItem) 16 | { 17 | InitializeComponent(); 18 | MenuItem = menuItem; 19 | InitializeControls(manager, menuItem); 20 | } 21 | 22 | private void InitializeControls(LanguageManager manager, Settings.MenuItem menuItem) 23 | { 24 | Text = manager.GetString("hotkeys_form"); 25 | btnApply.Text = manager.GetString("hotkeys_btn_apply"); 26 | btnCancel.Text = manager.GetString("hotkeys_btn_cancel"); 27 | lblKey1.Text = manager.GetString("hotkeys_lbl_key1"); 28 | lblKey2.Text = manager.GetString("hotkeys_lbl_key2"); 29 | lblKey3.Text = manager.GetString("hotkeys_lbl_key3"); 30 | 31 | cmbKey1.ValueMember = "Id"; 32 | cmbKey1.DisplayMember = "Text"; 33 | cmbKey1.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 34 | cmbKey1.SelectedValue = menuItem.Key1; 35 | 36 | cmbKey2.ValueMember = "Id"; 37 | cmbKey2.DisplayMember = "Text"; 38 | cmbKey2.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 39 | cmbKey2.SelectedValue = menuItem.Key2; 40 | 41 | cmbKey3.ValueMember = "Id"; 42 | cmbKey3.DisplayMember = "Text"; 43 | cmbKey3.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 44 | cmbKey3.SelectedValue = menuItem.Key3; 45 | } 46 | 47 | private void ButtonApplyClick(object sender, EventArgs e) 48 | { 49 | var menuItem = new Settings.MenuItem(); 50 | menuItem.Key1 = (VirtualKeyModifier)cmbKey1.SelectedValue; 51 | menuItem.Key2 = (VirtualKeyModifier)cmbKey2.SelectedValue; 52 | menuItem.Key3 = (VirtualKey)cmbKey3.SelectedValue; 53 | menuItem.Name = MenuItem.Name; 54 | MenuItem = menuItem; 55 | DialogResult = DialogResult.OK; 56 | Close(); 57 | } 58 | 59 | private void ButtonCancelClick(object sender, EventArgs e) => Close(); 60 | 61 | private void KeyDownClick(object sender, KeyEventArgs e) 62 | { 63 | if (e.KeyValue == 13) 64 | { 65 | ButtonApplyClick(sender, e); 66 | } 67 | 68 | if (e.KeyValue == 27) 69 | { 70 | Close(); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /SmartContextMenu/Controls/DataGridViewDisableButtonCell.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using System.Windows.Forms.VisualStyles; 3 | using System.Drawing; 4 | 5 | namespace SmartContextMenu.Controls 6 | { 7 | public class DataGridViewDisableButtonCell : DataGridViewButtonCell 8 | { 9 | public bool Enabled { get; set; } 10 | 11 | // Override the Clone method so that the Enabled property is copied. 12 | public override object Clone() 13 | { 14 | DataGridViewDisableButtonCell cell = (DataGridViewDisableButtonCell)base.Clone(); 15 | cell.Enabled = this.Enabled; 16 | return cell; 17 | } 18 | 19 | // By default, enable the button cell. 20 | public DataGridViewDisableButtonCell() 21 | { 22 | Enabled = true; 23 | } 24 | 25 | protected override void Paint(Graphics graphics, 26 | Rectangle clipBounds, Rectangle cellBounds, int rowIndex, 27 | DataGridViewElementStates elementState, object value, 28 | object formattedValue, string errorText, 29 | DataGridViewCellStyle cellStyle, 30 | DataGridViewAdvancedBorderStyle advancedBorderStyle, 31 | DataGridViewPaintParts paintParts) 32 | { 33 | // The button cell is disabled, so paint the border, 34 | // background, and disabled button for the cell. 35 | if (!Enabled) 36 | { 37 | // Draw the cell background, if specified. 38 | if ((paintParts & DataGridViewPaintParts.Background) == DataGridViewPaintParts.Background) 39 | { 40 | SolidBrush cellBackground = new SolidBrush(cellStyle.BackColor); 41 | graphics.FillRectangle(cellBackground, cellBounds); 42 | cellBackground.Dispose(); 43 | } 44 | 45 | // Draw the cell borders, if specified. 46 | if ((paintParts & DataGridViewPaintParts.Border) == DataGridViewPaintParts.Border) 47 | { 48 | PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); 49 | } 50 | 51 | // Calculate the area in which to draw the button. 52 | Rectangle buttonArea = cellBounds; 53 | Rectangle buttonAdjustment = BorderWidths(advancedBorderStyle); 54 | buttonArea.X += buttonAdjustment.X; 55 | buttonArea.Y += buttonAdjustment.Y; 56 | buttonArea.Height -= buttonAdjustment.Height; 57 | buttonArea.Width -= buttonAdjustment.Width; 58 | 59 | // Draw the disabled button. 60 | ButtonRenderer.DrawButton(graphics, buttonArea, PushButtonState.Disabled); 61 | 62 | // Draw the disabled button text. 63 | if (FormattedValue is string) 64 | { 65 | TextRenderer.DrawText(graphics, (string)FormattedValue, DataGridView.Font, buttonArea, SystemColors.GrayText); 66 | } 67 | } 68 | else 69 | { 70 | // The button cell is enabled, so let the base class 71 | // handle the painting. 72 | base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /SmartContextMenu/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 62 | 63 | 64 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/TransparencyForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class TransparencyForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransparencyForm)); 32 | this.btnApply = new System.Windows.Forms.Button(); 33 | this.numericTransparency = new System.Windows.Forms.NumericUpDown(); 34 | ((System.ComponentModel.ISupportInitialize)(this.numericTransparency)).BeginInit(); 35 | this.SuspendLayout(); 36 | // 37 | // btnApply 38 | // 39 | this.btnApply.Location = new System.Drawing.Point(100, 9); 40 | this.btnApply.Name = "btnApply"; 41 | this.btnApply.Size = new System.Drawing.Size(91, 26); 42 | this.btnApply.TabIndex = 1; 43 | this.btnApply.UseVisualStyleBackColor = true; 44 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 45 | // 46 | // numericTransparency 47 | // 48 | this.numericTransparency.Location = new System.Drawing.Point(12, 12); 49 | this.numericTransparency.Name = "numericTransparency"; 50 | this.numericTransparency.Size = new System.Drawing.Size(72, 20); 51 | this.numericTransparency.TabIndex = 0; 52 | this.numericTransparency.ValueChanged += new System.EventHandler(this.NumericTransparencyValueChanged); 53 | this.numericTransparency.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 54 | // 55 | // TransparencyForm 56 | // 57 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 58 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 59 | this.ClientSize = new System.Drawing.Size(203, 66); 60 | this.Controls.Add(this.numericTransparency); 61 | this.Controls.Add(this.btnApply); 62 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 63 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 64 | this.KeyPreview = true; 65 | this.MaximizeBox = false; 66 | this.MinimizeBox = false; 67 | this.Name = "TransparencyForm"; 68 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 69 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 70 | ((System.ComponentModel.ISupportInitialize)(this.numericTransparency)).EndInit(); 71 | this.ResumeLayout(false); 72 | 73 | } 74 | 75 | #endregion 76 | 77 | private System.Windows.Forms.Button btnApply; 78 | private System.Windows.Forms.NumericUpDown numericTransparency; 79 | } 80 | } -------------------------------------------------------------------------------- /SmartContextMenu/Utils/EnumUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Native.Enums; 3 | 4 | namespace SmartContextMenu.Utils 5 | { 6 | static class EnumUtils 7 | { 8 | public static WindowAlignment GetAlignment(string menuItemName) => menuItemName switch 9 | { 10 | MenuItemName.AlignTopLeft => WindowAlignment.TopLeft, 11 | MenuItemName.AlignTopCenter => WindowAlignment.TopCenter, 12 | MenuItemName.AlignTopRight => WindowAlignment.TopRight, 13 | MenuItemName.AlignMiddleLeft => WindowAlignment.MiddleLeft, 14 | MenuItemName.AlignMiddleCenter => WindowAlignment.MiddleCenter, 15 | MenuItemName.AlignMiddleRight => WindowAlignment.MiddleRight, 16 | MenuItemName.AlignBottomLeft => WindowAlignment.BottomLeft, 17 | MenuItemName.AlignBottomCenter => WindowAlignment.BottomCenter, 18 | MenuItemName.AlignBottomRight => WindowAlignment.BottomRight, 19 | MenuItemName.AlignCenterHorizontally => WindowAlignment.CenterHorizontally, 20 | MenuItemName.AlignCenterVertically => WindowAlignment.CenterVertically, 21 | _ => throw new ArgumentException(nameof(menuItemName)) 22 | }; 23 | 24 | public static Priority GetPriority(string menuItemName) => menuItemName switch 25 | { 26 | MenuItemName.PriorityRealTime => Priority.RealTime, 27 | MenuItemName.PriorityHigh => Priority.High, 28 | MenuItemName.PriorityAboveNormal => Priority.AboveNormal, 29 | MenuItemName.PriorityNormal => Priority.Normal, 30 | MenuItemName.PriorityBelowNormal => Priority.BelowNormal, 31 | MenuItemName.PriorityIdle => Priority.Idle, 32 | _ => throw new ArgumentException(nameof(menuItemName)) 33 | }; 34 | 35 | public static string GetPriorityMenuItemName(Priority priority) => priority switch 36 | { 37 | Priority.RealTime => MenuItemName.PriorityRealTime, 38 | Priority.High => MenuItemName.PriorityHigh, 39 | Priority.AboveNormal => MenuItemName.PriorityAboveNormal, 40 | Priority.Normal => MenuItemName.PriorityNormal, 41 | Priority.BelowNormal => MenuItemName.PriorityBelowNormal, 42 | Priority.Idle => MenuItemName.PriorityIdle, 43 | _ => null 44 | }; 45 | 46 | public static int GetTransparency(string menuItemName) => menuItemName switch 47 | { 48 | MenuItemName.TransparencyOpaque => 0, 49 | MenuItemName.Transparency10 => 10, 50 | MenuItemName.Transparency20 => 20, 51 | MenuItemName.Transparency30 => 30, 52 | MenuItemName.Transparency40 => 40, 53 | MenuItemName.Transparency50 => 50, 54 | MenuItemName.Transparency60 => 60, 55 | MenuItemName.Transparency70 => 70, 56 | MenuItemName.Transparency80 => 80, 57 | MenuItemName.Transparency90 => 90, 58 | MenuItemName.TransparencyInvisible => 100, 59 | _ => throw new ArgumentException(nameof(menuItemName)) 60 | }; 61 | 62 | public static string GetTransparencyMenuItemName(int transparency) => transparency switch 63 | { 64 | 0 => MenuItemName.TransparencyOpaque, 65 | 10 => MenuItemName.Transparency10, 66 | 20 => MenuItemName.Transparency20, 67 | 30 => MenuItemName.Transparency30, 68 | 40 => MenuItemName.Transparency40, 69 | 50 => MenuItemName.Transparency50, 70 | 60 => MenuItemName.Transparency60, 71 | 70 => MenuItemName.Transparency70, 72 | 80 => MenuItemName.Transparency80, 73 | 90 => MenuItemName.Transparency90, 74 | 100 => MenuItemName.TransparencyInvisible, 75 | _ => null 76 | }; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/ParameterForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class ParameterForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | /// Contains language strings. 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ParameterForm)); 33 | this.lblParameter = new System.Windows.Forms.Label(); 34 | this.btnApply = new System.Windows.Forms.Button(); 35 | this.txtParameterValue = new System.Windows.Forms.TextBox(); 36 | this.SuspendLayout(); 37 | // 38 | // lblParameter 39 | // 40 | this.lblParameter.AutoSize = true; 41 | this.lblParameter.Location = new System.Drawing.Point(12, 17); 42 | this.lblParameter.Name = "lblParameter"; 43 | this.lblParameter.Size = new System.Drawing.Size(0, 13); 44 | this.lblParameter.TabIndex = 2; 45 | // 46 | // btnApply 47 | // 48 | this.btnApply.Location = new System.Drawing.Point(189, 69); 49 | this.btnApply.Name = "btnApply"; 50 | this.btnApply.Size = new System.Drawing.Size(91, 26); 51 | this.btnApply.TabIndex = 4; 52 | this.btnApply.UseVisualStyleBackColor = true; 53 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 54 | // 55 | // txtParameterValue 56 | // 57 | this.txtParameterValue.Location = new System.Drawing.Point(12, 33); 58 | this.txtParameterValue.Name = "txtParameterValue"; 59 | this.txtParameterValue.Size = new System.Drawing.Size(268, 20); 60 | this.txtParameterValue.TabIndex = 3; 61 | // 62 | // ParameterForm 63 | // 64 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 65 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 66 | this.ClientSize = new System.Drawing.Size(296, 122); 67 | this.Controls.Add(this.txtParameterValue); 68 | this.Controls.Add(this.btnApply); 69 | this.Controls.Add(this.lblParameter); 70 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 71 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 72 | this.KeyPreview = true; 73 | this.MaximizeBox = false; 74 | this.MinimizeBox = false; 75 | this.Name = "ParameterForm"; 76 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 77 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 78 | this.ResumeLayout(false); 79 | this.PerformLayout(); 80 | 81 | } 82 | 83 | #endregion 84 | private System.Windows.Forms.Label lblParameter; 85 | private System.Windows.Forms.Button btnApply; 86 | private System.Windows.Forms.TextBox txtParameterValue; 87 | } 88 | } -------------------------------------------------------------------------------- /SmartContextMenu/WindowDetails.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Native.Enums; 3 | using SmartContextMenu.Native.Structs; 4 | 5 | namespace SmartContextMenu 6 | { 7 | public class WindowDetails 8 | { 9 | public string GetWindowText { get; set; } 10 | 11 | public string WM_GETTEXT { get; set; } 12 | 13 | public string GetClassName { get; set; } 14 | 15 | public string RealGetWindowClass { get; set; } 16 | 17 | public string FontName { get; set; } 18 | 19 | public IntPtr Handle { get; set; } 20 | 21 | public IntPtr ParentHandle { get; set; } 22 | 23 | public Rect Size { get; set; } 24 | 25 | public Rect ClientSize { get; set; } 26 | 27 | public Rect FrameBounds { get; set; } 28 | 29 | public IntPtr Instance { get; set; } 30 | 31 | public int ProcessId { get; set; } 32 | 33 | public uint ThreadId { get; set; } 34 | 35 | public int GCL_WNDPROC { get; set; } 36 | 37 | public int DWL_DLGPROC { get; set; } 38 | 39 | public long GWL_STYLE { get; set; } 40 | 41 | public int GCL_STYLE { get; set; } 42 | 43 | public long GWL_EXSTYLE { get; set; } 44 | 45 | public uint WindowInfoExStyle { get; set; } 46 | 47 | public bool LWA_ALPHA { get; set; } 48 | 49 | public bool LWA_COLORKEY { get; set; } 50 | 51 | public long GWL_ID { get; set; } 52 | 53 | public long GWL_USERDATA { get; set; } 54 | 55 | public int DWL_USER { get; set; } 56 | 57 | public string AccessibleName { get; set; } 58 | 59 | public string AccessibleValue { get; set; } 60 | 61 | public string AccessibleRole { get; set; } 62 | 63 | public string AccessibleDescription { get; set; } 64 | 65 | public string FullPath { get; set; } 66 | 67 | public string CommandLine { get; set; } 68 | 69 | public string CurrentDirectory { get; set; } 70 | 71 | public string Owner { get; set; } 72 | 73 | public uint HandleCount { get; set; } 74 | 75 | public uint ThreadCount { get; set; } 76 | 77 | public ulong VirtualSize { get; set; } 78 | 79 | public ulong WorkingSetSize { get; set; } 80 | 81 | public DateTime? StartTime { get; set; } 82 | 83 | public string Parent { get; set; } 84 | 85 | public Priority Priority { get; set; } 86 | 87 | public string ProductName { get; set; } 88 | 89 | public string FileVersion { get; set; } 90 | 91 | public string ProductVersion { get; set; } 92 | 93 | public string Copyright { get; set; } 94 | 95 | public WindowDetails() 96 | { 97 | GetWindowText = ""; 98 | WM_GETTEXT = ""; 99 | GetClassName = ""; 100 | RealGetWindowClass = ""; 101 | FontName = ""; 102 | Handle = IntPtr.Zero; 103 | ParentHandle = IntPtr.Zero; 104 | Size = new Rect(); 105 | ClientSize = new Rect(); 106 | FrameBounds = new Rect(); 107 | Instance = IntPtr.Zero; 108 | ProcessId = 0; 109 | ThreadId = 0; 110 | GCL_WNDPROC = 0; 111 | DWL_DLGPROC = 0; 112 | GWL_STYLE = 0; 113 | GCL_STYLE = 0; 114 | GWL_EXSTYLE = 0; 115 | WindowInfoExStyle = 0; 116 | LWA_ALPHA = false; 117 | LWA_COLORKEY = false; 118 | GWL_ID = 0; 119 | GWL_USERDATA = 0; 120 | DWL_USER = 0; 121 | AccessibleName = ""; 122 | AccessibleValue = ""; 123 | AccessibleRole = ""; 124 | AccessibleDescription = ""; 125 | FullPath = ""; 126 | CommandLine = ""; 127 | CurrentDirectory = ""; 128 | Owner = ""; 129 | HandleCount = 0; 130 | ThreadCount = 0; 131 | VirtualSize = 0; 132 | WorkingSetSize = 0; 133 | StartTime = null; 134 | Parent = ""; 135 | Priority = 0; 136 | ProductName = ""; 137 | FileVersion = ""; 138 | ProductVersion = ""; 139 | Copyright = ""; 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /SmartContextMenu/Forms/MessageBoxForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class MessageBoxForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MessageBoxForm)); 32 | this.btnOk = new System.Windows.Forms.Button(); 33 | this.txtMessage = new System.Windows.Forms.TextBox(); 34 | this.SuspendLayout(); 35 | // 36 | // btnOk 37 | // 38 | this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 39 | this.btnOk.Location = new System.Drawing.Point(677, 507); 40 | this.btnOk.Name = "btnOk"; 41 | this.btnOk.Size = new System.Drawing.Size(115, 30); 42 | this.btnOk.TabIndex = 0; 43 | this.btnOk.Text = "Ok"; 44 | this.btnOk.UseVisualStyleBackColor = true; 45 | this.btnOk.Click += new System.EventHandler(this.OkClick); 46 | // 47 | // txtMessage 48 | // 49 | this.txtMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 50 | | System.Windows.Forms.AnchorStyles.Left) 51 | | System.Windows.Forms.AnchorStyles.Right))); 52 | this.txtMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 53 | this.txtMessage.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 54 | this.txtMessage.Location = new System.Drawing.Point(12, 12); 55 | this.txtMessage.Multiline = true; 56 | this.txtMessage.Name = "txtMessage"; 57 | this.txtMessage.ReadOnly = true; 58 | this.txtMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 59 | this.txtMessage.Size = new System.Drawing.Size(780, 477); 60 | this.txtMessage.TabIndex = 1; 61 | this.txtMessage.TabStop = false; 62 | // 63 | // MessageBoxForm 64 | // 65 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 67 | this.AutoSize = true; 68 | this.ClientSize = new System.Drawing.Size(804, 571); 69 | this.Controls.Add(this.txtMessage); 70 | this.Controls.Add(this.btnOk); 71 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 72 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 73 | this.KeyPreview = true; 74 | this.MaximizeBox = false; 75 | this.MinimizeBox = false; 76 | this.Name = "MessageBoxForm"; 77 | this.ShowIcon = false; 78 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 79 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 80 | this.ResumeLayout(false); 81 | this.PerformLayout(); 82 | 83 | } 84 | 85 | #endregion 86 | private System.Windows.Forms.Button btnOk; 87 | private System.Windows.Forms.TextBox txtMessage; 88 | } 89 | } -------------------------------------------------------------------------------- /SmartContextMenu/Extensions/ProcessExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Diagnostics; 4 | using System.Collections.Generic; 5 | using System.Runtime.InteropServices; 6 | using SmartContextMenu.Native; 7 | using SmartContextMenu.Native.Enums; 8 | using SmartContextMenu.Native.Structs; 9 | using static SmartContextMenu.Native.Kernel32; 10 | using static SmartContextMenu.Native.Ntdll; 11 | using static SmartContextMenu.Native.Constants; 12 | 13 | namespace SmartContextMenu.Extensions 14 | { 15 | static class ProcessExtensions 16 | { 17 | public static IntPtr GetHandle(this Process process) 18 | { 19 | var hProcess = Environment.OSVersion.Version.Major >= 6 ? 20 | OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_SET_INFORMATION, false, process.Id) : 21 | OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SET_INFORMATION, false, process.Id); 22 | return hProcess; 23 | } 24 | 25 | public static string GetMainModuleFileName(this Process process, int buffer = 1024) 26 | { 27 | try 28 | { 29 | return process.MainModule.FileName; 30 | } 31 | catch 32 | { 33 | var fileNameBuilder = new StringBuilder(buffer); 34 | var bufferLength = (uint)fileNameBuilder.Capacity + 1; 35 | return QueryFullProcessImageName(process.GetHandle(), 0, fileNameBuilder, ref bufferLength) ? fileNameBuilder.ToString() : null; 36 | } 37 | } 38 | 39 | public static IList GetWindowHandles(this Process process) 40 | { 41 | var handles = new List(); 42 | foreach (ProcessThread thread in process.Threads) 43 | { 44 | User32.EnumThreadWindows(thread.Id, (hwnd, lParam) => { handles.Add(hwnd); return true; }, 0); 45 | } 46 | return handles; 47 | } 48 | 49 | public static Process GetParentProcess(this Process process) 50 | { 51 | var pbi = new ProcessBasicInformation(); 52 | var status = NtQueryInformationProcess(process.GetHandle(), 0, ref pbi, Marshal.SizeOf(pbi), out _); 53 | if (status != 0) 54 | { 55 | return null; 56 | } 57 | 58 | try 59 | { 60 | return Process.GetProcessById(pbi.InheritedFromUniqueProcessId.ToInt32()); 61 | } 62 | catch 63 | { 64 | return null; 65 | } 66 | } 67 | 68 | public static void Suspend(this Process process) 69 | { 70 | foreach (ProcessThread thread in process.Threads) 71 | { 72 | var pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thread.Id); 73 | if (pOpenThread == IntPtr.Zero) 74 | { 75 | continue; 76 | } 77 | SuspendThread(pOpenThread); 78 | CloseHandle(pOpenThread); 79 | } 80 | } 81 | 82 | public static void Resume(this Process process) 83 | { 84 | foreach (ProcessThread thread in process.Threads) 85 | { 86 | var pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thread.Id); 87 | if (pOpenThread == IntPtr.Zero) 88 | { 89 | continue; 90 | } 91 | 92 | int suspendCount; 93 | do 94 | { 95 | suspendCount = ResumeThread(pOpenThread); 96 | } while (suspendCount > 0); 97 | 98 | CloseHandle(pOpenThread); 99 | } 100 | } 101 | 102 | public static bool IsSuspended(this Process process) => process.Threads[0].ThreadState == ThreadState.Wait; 103 | 104 | public static Priority GetPriority(this Process process) 105 | { 106 | if (process == null) 107 | { 108 | return Priority.Normal; 109 | } 110 | 111 | var priorityClass = GetPriorityClass(process.GetHandle()); 112 | return priorityClass.GetPriority(); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/TitleForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class TitleForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | /// Contains language strings. 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TitleForm)); 33 | this.btnApply = new System.Windows.Forms.Button(); 34 | this.txtTitle = new System.Windows.Forms.TextBox(); 35 | this.btnCancel = new System.Windows.Forms.Button(); 36 | this.SuspendLayout(); 37 | // 38 | // btnApply 39 | // 40 | this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 41 | this.btnApply.Location = new System.Drawing.Point(283, 164); 42 | this.btnApply.Name = "btnApply"; 43 | this.btnApply.Size = new System.Drawing.Size(91, 26); 44 | this.btnApply.TabIndex = 1; 45 | this.btnApply.UseVisualStyleBackColor = true; 46 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 47 | // 48 | // txtTitle 49 | // 50 | this.txtTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 51 | | System.Windows.Forms.AnchorStyles.Left) 52 | | System.Windows.Forms.AnchorStyles.Right))); 53 | this.txtTitle.Location = new System.Drawing.Point(12, 12); 54 | this.txtTitle.Multiline = true; 55 | this.txtTitle.Name = "txtTitle"; 56 | this.txtTitle.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 57 | this.txtTitle.Size = new System.Drawing.Size(459, 135); 58 | this.txtTitle.TabIndex = 0; 59 | // 60 | // btnCancel 61 | // 62 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 63 | this.btnCancel.Location = new System.Drawing.Point(380, 164); 64 | this.btnCancel.Name = "btnCancel"; 65 | this.btnCancel.Size = new System.Drawing.Size(91, 26); 66 | this.btnCancel.TabIndex = 2; 67 | this.btnCancel.UseVisualStyleBackColor = true; 68 | this.btnCancel.Click += new System.EventHandler(this.ButtonCancelClick); 69 | // 70 | // TitleForm 71 | // 72 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 74 | this.ClientSize = new System.Drawing.Size(484, 211); 75 | this.Controls.Add(this.btnCancel); 76 | this.Controls.Add(this.txtTitle); 77 | this.Controls.Add(this.btnApply); 78 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 79 | this.KeyPreview = true; 80 | this.MaximizeBox = false; 81 | this.MinimizeBox = false; 82 | this.Name = "TitleForm"; 83 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 84 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 85 | this.ResumeLayout(false); 86 | this.PerformLayout(); 87 | 88 | } 89 | 90 | #endregion 91 | private System.Windows.Forms.Button btnApply; 92 | private System.Windows.Forms.TextBox txtTitle; 93 | private System.Windows.Forms.Button btnCancel; 94 | } 95 | } -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | logo 4 | 5 | # SmartContextMenu 6 | 7 |
8 | 9 | 🌏: [English](/) [Русский](/README_RU.md) [**中文版**](/README_CN.md) [한국어](/README_KO.md) 10 | 11 | --- 12 | 13 | SmartContextMenu为您的操作系统的所有窗口添加了一个上下文菜单。该程序是SmartSystemMenu的改进版,希望它更加方便使用,因为它支持所有窗口的操作,包括没有系统菜单的窗口。此外,它更加稳定且轻量,因为它不使用独立DLL模块的hooks。要使用该应用程序,需要启动SmartContextMenu.exe文件,将鼠标光标移到需要的窗口上,并使用“Ctrl + 右键单击”的快捷键。所有菜单设置和快捷键可以在系统托盘中的应用程序界面中更改,也可以在SmartContextMenu.xml文件中进行修改。可用的菜单项包括: 14 | 15 | 16 | * **详细信息.** 显示一个对话框,其中包含当前窗口和进程的信息:窗口句柄、窗口标题、窗口风格、窗口类、进程名称、进程ID、进程路径。 17 | * **隐藏.** 允许隐藏当前窗口。 18 | * **卷起窗口.** 将当前窗口向上卷起。 19 | * **无边框.** 允许将窗口显示为无边框模式,适用于窗口化的游戏。 20 | * **毛玻璃效果.** 将 "毛玻璃效果" 模糊添加到当前窗口。(仅 Windows Vista 及更高版本支持。主要用于控制台窗口。) 21 | * **窗口始终置顶.** 将当前窗口保持在所有其他窗口之上。 22 | * **更改图标.** 允许更改当前窗口的图标。 23 | * **更改标题.** 允许更改当前窗口的标题。 24 | * **窗口置底.** 将当前窗口保持在所有其他窗口之下。 25 | * **保存窗口截图.** 将当前窗口的屏幕截图保存到文件中。 26 | * **在资源管理器中进入程序路径.** 在文件资源管理器中打开进程文件。 27 | * **通过鼠标拖动.** 允许通过鼠标拖动当前窗口。 28 | * **点击时穿过窗口.** 允许点击穿透当前窗口。 29 | * **在 Alt+Tab 列表中隐藏.** 允许当前窗口在任务栏和 Alt+Tab 切换中隐藏。 30 | * **调整窗口大小到.** 更改当前窗口的大小。 31 | * **移动到.** 将当前窗口移动到另一个显示器。 32 | * **对齐窗口到.** 当前窗口与桌面上的9个位置中的任何一个对齐。 33 | * **透明度.** 更改当前窗口的透明度。 34 | * **优先级.** 更改当前窗口的程序优先级。 35 | * **剪贴板操作.** 复制所有窗口文本 (包括控制台、MS Office 产品等) 到剪贴板中,同时支持清除剪贴板。 36 | * **突出窗口操作.** 使除当前焦点窗口之外的所有窗口变暗。 37 | * **按钮操作.** 允许禁用 "最小化" 、 "最大化" 和 "关闭" 按钮。 38 | * **系统托盘.** 将当前窗口最小化或挂起到系统托盘。 39 | * **系统菜单.** 含有系统菜单各项内容。 40 | * **其他窗口操作.** 关闭和最小化系统中除当前窗口之外的所有窗口。 41 | * **启动.** 启动设置中的程序。 42 | 43 | 截图 44 | ------------------ 45 | 46 | ![Resize](./SmartContextMenu/Images/SmartContextMenuCn1.png) 47 | ![Alignment](./SmartContextMenu/Images/SmartContextMenuCn2.png) 48 | ![System Menu](./SmartContextMenu/Images/SmartContextMenuCn3.png) 49 | 50 | ## 命令行接口 51 | 52 | ```bash 53 | --help The help 54 | --title Title 55 | --titleBegins Title begins 56 | --titleEnds Title ends 57 | --titleContains Title contains 58 | --handle Handle (1234567890) (0xFFFFFF) 59 | --processId PID (1234567890) 60 | -d --delay Delay in milliseconds 61 | -l --left Left 62 | -t --top Top 63 | -w --width Width 64 | -h --height Height 65 | -i --information Information dialog 66 | -s --savescreenshot Save Screenshot 67 | -m --monitor [0, 1, 2, 3, ...] 68 | -a --alignment [topleft, 69 | topcenter, 70 | topright, 71 | middleleft, 72 | middlecenter, 73 | middleright, 74 | bottomleft, 75 | bottomcenter, 76 | bottomright, 77 | centerhorizontally, 78 | centervertically] 79 | -p --priority [realtime, 80 | high, 81 | abovenormal, 82 | normal, 83 | belownormal, 84 | idle] 85 | --systemmenu [restore, 86 | minimize, 87 | maximize, 88 | close] 89 | --transparency [0 ... 100] 90 | --alwaysontop [on, off] 91 | -g --aeroglass [on, off] 92 | --hide [on, off] 93 | --hidealttab [on, off] 94 | --clickthrough [on, off] 95 | --minimizebutton [on, off] 96 | --maximizebutton [on, off] 97 | --sendtobottom Send To Bottom 98 | -b --borderless Borderless 99 | -r --rollup Roll Up 100 | -o --openinexplorer Open File In Explorer 101 | -c --copytoclipboard Copy Window Text To Clipboard 102 | --copyscreenshot Copy Screenshot To Clipboard 103 | --clearclipboard Clear Clipboard 104 | -n --nogui No GUI 105 | 106 | Example: 107 | SmartContextMenu.exe --title "Untitled - Notepad" -a topleft -p high --alwaysontop on --nogui 108 | ``` 109 | 110 | 安装方法 111 | -------------------- 112 | 113 | - 下载 [SmartContextMenu](https://github.com/AlexanderPro/SmartContextMenu/releases) zip 压缩包文件 114 | - [Chocolatey](https://chocolatey.org/): `choco install smartcontextmenu` 115 | - [Scoop](https://scoop.sh/): `scoop bucket add extras` and `scoop install extras/smartcontextmenu` 116 | 117 | 要求 118 | -------------------- 119 | 120 | * OS Windows XP SP3 及更高版本。 支持 x86 和 x64 系统。 121 | * .NET Framework 4.0 122 | 123 | 程序文件 124 | -------------------- 125 | 126 | SmartContextMenu.exe 127 | SmartContextMenu.xml (位于用户配置文件目录中。如果计划将该应用程序作为便携式使用,请将此文件复制到 SmartContextMenu.exe 所在的目录中。) 128 | -------------------------------------------------------------------------------- /SmartContextMenu/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SmartContextMenu.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SmartContextMenu.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap ArrowDown { 67 | get { 68 | object obj = ResourceManager.GetObject("ArrowDown", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap ArrowUp { 77 | get { 78 | object obj = ResourceManager.GetObject("ArrowUp", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 85 | /// 86 | internal static System.Drawing.Icon SmartContextMenu { 87 | get { 88 | object obj = ResourceManager.GetObject("SmartContextMenu", resourceCulture); 89 | return ((System.Drawing.Icon)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap SmartContextMenuImage { 97 | get { 98 | object obj = ResourceManager.GetObject("SmartContextMenuImage", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /README_KO.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | logo 4 | 5 | # SmartContextMenu 6 | 7 |
8 | 9 | 🌏: [English](/) [Русский](/README_RU.md) [中文版](/README_CN.md) [**한국어**](/README_KO.md) 10 | 11 | --- 12 | 13 | SmartContextMenu는 시스템의 모든 창에 컨텍스트 메뉴를 추가합니다. 14 | 이 프로그램은 [SmartSystemMenu](https://github.com/AlexanderPro/SmartSystemMenu)의 향상된 버전입니다. 15 | 시스템 메뉴가 없는 창을 포함하여 모든 유형의 창을 지원하므로 더욱 편리해지기를 바랍니다. 16 | 또한 별도의 DLL 모듈에 있는 후크를 사용하지 않으므로 안정성과 가벼움이 더욱 뛰어납니다. 17 | 앱을 사용하려면 SmartContextMenu.exe 파일을 실행하고 마우스 커서를 원하는 창으로 이동한 후 단축키 “**Ctrl + 오른쪽 마우스 버튼**”을 사용하세요. 18 | 모든 메뉴 설정과 단축키는 시스템 트레이의 설정 대화상자와 SmartContextMenu.xml 파일에서 변경할 수 있습니다. 19 | 사용 가능한 메뉴 항목: 20 | 21 | * **정보.** 현재 창과 프로세스에 대한 정보 (창 핸들, 창 캡션, 창 스타일, 창 클래스, 프로세스 이름, 프로세스 ID, 프로세스 경로)가 있는 대화 상자를 표시합니다. 22 | * **에어로 글래스.** 현재 창에 "에어로 글래스" 흐림 효과를 추가할 수 있습니다. (Windows Vista 이상. 주로 콘솔 창에 사용됨) 23 | * **항상 맨 위에.** 현재 창을 다른 모든 창 위에 고정시킵니다. 24 | * **테두리 없음.** 창으로 실행되는 게임을 "테두리 없음" 모드로 전환합니다. 25 | * **어둡게.** 현재 초점이 있는 창을 제외한 모든 창을 어둡게 합니다. 26 | * **숨기기.** 현재 창을 숨길 수 있습니다. 27 | * **롤업.** 현재 창을 말아 올리거나 내릴 수 있습니다. 28 | * **아래로 보내기.** 현재 창을 아래로 보낼 수 있습니다. 29 | * **아이콘 변경.** 현재 창의 아이콘을 변경할 수 있습니다. 30 | * **제목 변경.** 제목 표시줄의 텍스트를 변경할 수 있습니다. 31 | * **스크린샷 저장.** 현재 창의 스크린샷을 파일에 저장할 수 있습니다. 32 | * **탐색기에서 파일 열기.** 파일 탐색기에서 프로세스 파일을 열 수 있습니다. 33 | * **클릭 통과.** 현재 창을 통과하여 클릭할 수 있게 합니다. 34 | * **Alt+Tab 숨기기.** 작업 표시줄 및 Alt+Tab 전환 시 현재 창을 숨깁니다 35 | * **크기 조정.** 현재 창의 크기를 변경할 수 있습니다. 36 | * **이동.** 현재 창을 다른 모니터로 이동할 수 있습니다. 37 | * **정렬.** 현재 창을 바탕 화면의 9개 위치 중 원하는 위치에 맞출 수 있습니다. 38 | * **투명도.** 현재 창의 투명도를 변경할 수 있습니다. 39 | * **우선순위.** 현재 창의 프로그램 우선 순위를 변경할 수 있습니다. 40 | * **클립보드.** 모든 창 텍스트 (콘솔, MS 오피스 제품 등 포함)를 클립보드에 복사하고 클립보드를 지울 수 있습니다. 41 | * **버튼.** "최소화", "최대화" 및 "닫기" 버튼을 비활성화할 수 있습니다. 42 | * **시스템 트레이.** 현재 창을 최소화하거나 시스템 트레이에 일시 중지할 수 있습니다. 43 | * **시스템 메뉴.** 시스템 메뉴 항목을 포함합니다. 44 | * **기타 창.** 현재 창을 제외한 시스템의 모든 창을 닫고 최소화할 수 있습니다. 45 | * **시작 프로그램.** 설정에서 프로그램을 시작할 수 있습니다. 46 | 47 | 스크린샷 48 | ------------------ 49 | 50 | ![Resize](./SmartContextMenu/Images/SmartContextMenuKo1.png) 51 | ![Alignment](./SmartContextMenu/Images/SmartContextMenuKo2.png) 52 | ![System Menu](./SmartContextMenu/Images/SmartContextMenuKo3.png) 53 | 54 | 명령줄 인터페이스 55 | -------------------- 56 | 57 | ```bash 58 | --help 도움말 59 | --title 제목 60 | --titleBegins 제목 시작 61 | --titleEnds 제목 끝 62 | --titleContains 제목 포함 63 | --handle 핸들 (1234567890) (0xFFFFFF) 64 | --processId PID (1234567890) 65 | -d --delay 지연 시간 (밀리초) 66 | -l --left 왼쪽 67 | -t --top 위쪽 68 | -w --width 너비 69 | -h --height 높이 70 | -i --information 정보 대화상자 71 | -s --savescreenshot 스크린샷 저장 72 | -m --monitor [0, 1, 2, 3, ...] 73 | -a --alignment [왼쪽 위, 74 | 위 가운데, 75 | 오른쪽 위, 76 | 왼쪽 중간, 77 | 가운데 중간, 78 | 오른쪽 중간, 79 | 왼쪽 아래, 80 | 아래 가운데, 81 | 오른쪽 아래, 82 | 가로 중심, 83 | 세로 중심] 84 | -p --priority [실시간, 85 | 높음, 86 | 정상 이상, 87 | 정상, 88 | 정상 이하, 89 | 유휴] 90 | --systemmenu [복원, 91 | 최소화, 92 | 최대화, 93 | 닫기] 94 | --transparency [0 ... 100] 95 | --alwaysontop [켜기, 끄기] 96 | -g --aeroglass [켜기, 끄기] 97 | --hide [켜기, 끄기] 98 | --hidealttab [켜기, 끄기] 99 | --clickthrough [켜기, 끄기] 100 | --minimizebutton [켜기, 끄기] 101 | --maximizebutton [켜기, 끄기] 102 | --sendtobottom 맨 아래로 보내기 103 | -b --borderless 테두리 없음 104 | -r --rollup 롤업 105 | -o --openinexplorer 탐색기에서 파일 열기 106 | -c --copytoclipboard 창 텍스트를 클립보드에 복사 107 | --copyscreenshot 스크린샷을 클립보드에 복사 108 | --clearclipboard 클립보드 지우기 109 | -n --nogui GUI 없음 110 | 111 | 예: 112 | SmartContextMenu.exe --title "Untitled - Notepad" -a topleft -p high --alwaysontop on --nogui 113 | ``` 114 | 115 | 설치 116 | -------------------- 117 | 118 | * zip 파일에서 [SmartContextMenu](https://github.com/AlexanderPro/SmartContextMenu/releases) 다운로드 119 | * [Chocolatey](https://chocolatey.org/): `choco install smartcontextmenu` 120 | * [Scoop](https://scoop.sh/): `scoop bucket add extras` 및 `scoop install extras/smartcontextmenu` 121 | 122 | 요구 사항 123 | -------------------- 124 | 125 | * OS Windows XP SP3 이상. x86 및 x64 시스템을 지원합니다. 126 | * .NET Framework 4.0 127 | 128 | 파일 129 | -------------------- 130 | 131 | * SmartContextMenu.exe 132 | * SmartContextMenu.xml (roaming 사용자 디렉터리에 저장됩니다. SmartContextMenu를 포터블 앱으로 사용하려면 SmartContextMenu.exe 파일이 있는 디렉터리에 파일을 복사하세요.) 133 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/PositionForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class PositionForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | /// Contains language strings. 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PositionForm)); 33 | this.lblLeft = new System.Windows.Forms.Label(); 34 | this.lblTop = new System.Windows.Forms.Label(); 35 | this.btnApply = new System.Windows.Forms.Button(); 36 | this.txtLeft = new System.Windows.Forms.TextBox(); 37 | this.txtTop = new System.Windows.Forms.TextBox(); 38 | this.SuspendLayout(); 39 | // 40 | // lblLeft 41 | // 42 | this.lblLeft.AutoSize = true; 43 | this.lblLeft.Location = new System.Drawing.Point(12, 14); 44 | this.lblLeft.Name = "lblLeft"; 45 | this.lblLeft.Size = new System.Drawing.Size(0, 13); 46 | this.lblLeft.TabIndex = 0; 47 | // 48 | // lblTop 49 | // 50 | this.lblTop.AutoSize = true; 51 | this.lblTop.Location = new System.Drawing.Point(199, 14); 52 | this.lblTop.Name = "lblTop"; 53 | this.lblTop.Size = new System.Drawing.Size(0, 13); 54 | this.lblTop.TabIndex = 2; 55 | // 56 | // btnApply 57 | // 58 | this.btnApply.Location = new System.Drawing.Point(268, 69); 59 | this.btnApply.Name = "btnApply"; 60 | this.btnApply.Size = new System.Drawing.Size(91, 26); 61 | this.btnApply.TabIndex = 4; 62 | this.btnApply.UseVisualStyleBackColor = true; 63 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 64 | // 65 | // txtLeft 66 | // 67 | this.txtLeft.Location = new System.Drawing.Point(15, 33); 68 | this.txtLeft.Name = "txtLeft"; 69 | this.txtLeft.Size = new System.Drawing.Size(157, 20); 70 | this.txtLeft.TabIndex = 1; 71 | // 72 | // txtTop 73 | // 74 | this.txtTop.Location = new System.Drawing.Point(202, 33); 75 | this.txtTop.Name = "txtTop"; 76 | this.txtTop.Size = new System.Drawing.Size(157, 20); 77 | this.txtTop.TabIndex = 3; 78 | // 79 | // PositionForm 80 | // 81 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 82 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 83 | this.ClientSize = new System.Drawing.Size(376, 129); 84 | this.Controls.Add(this.txtTop); 85 | this.Controls.Add(this.txtLeft); 86 | this.Controls.Add(this.btnApply); 87 | this.Controls.Add(this.lblTop); 88 | this.Controls.Add(this.lblLeft); 89 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 90 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 91 | this.KeyPreview = true; 92 | this.MaximizeBox = false; 93 | this.MinimizeBox = false; 94 | this.Name = "PositionForm"; 95 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 96 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 97 | this.ResumeLayout(false); 98 | this.PerformLayout(); 99 | 100 | } 101 | 102 | #endregion 103 | private System.Windows.Forms.Label lblLeft; 104 | private System.Windows.Forms.Label lblTop; 105 | private System.Windows.Forms.Button btnApply; 106 | private System.Windows.Forms.TextBox txtLeft; 107 | private System.Windows.Forms.TextBox txtTop; 108 | } 109 | } -------------------------------------------------------------------------------- /SmartContextMenu/Hooks/MouseHook.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SmartContextMenu.Native.Structs; 3 | using static SmartContextMenu.Native.Kernel32; 4 | using static SmartContextMenu.Native.User32; 5 | using static SmartContextMenu.Native.Constants; 6 | 7 | namespace SmartContextMenu.Hooks 8 | { 9 | class MouseHook : IDisposable 10 | { 11 | private readonly string _moduleName; 12 | private readonly MouseHookProc _hookProc; 13 | private IntPtr _hookHandle; 14 | 15 | public event EventHandler Hooked; 16 | public event EventHandler ClickHooked; 17 | 18 | public VirtualKeyModifier Key1 { get; set; } 19 | public VirtualKeyModifier Key2 { get; set; } 20 | public VirtualKey Key3 { get; set; } 21 | public VirtualKey Key4 { get; set; } 22 | public MouseButton MouseButton { get; set; } 23 | 24 | public MouseHook(VirtualKeyModifier key1, VirtualKeyModifier key2, VirtualKey key3, VirtualKey key4, MouseButton mouseButton, string moduleName) 25 | { 26 | Key1 = key1; 27 | Key2 = key2; 28 | Key3 = key3; 29 | Key4 = key4; 30 | MouseButton = mouseButton; 31 | _moduleName = moduleName; 32 | _hookProc = HookProc; 33 | } 34 | 35 | public bool Start() 36 | { 37 | var moduleHandle = GetModuleHandle(_moduleName); 38 | _hookHandle = SetWindowsHookEx(WH_MOUSE_LL, _hookProc, moduleHandle, 0); 39 | return _hookHandle != IntPtr.Zero; 40 | } 41 | 42 | public bool Stop() 43 | { 44 | if (_hookHandle == IntPtr.Zero) 45 | { 46 | return true; 47 | } 48 | var hookStoped = UnhookWindowsHookEx(_hookHandle); 49 | return hookStoped; 50 | } 51 | 52 | public void Dispose() 53 | { 54 | Dispose(true); 55 | GC.SuppressFinalize(this); 56 | } 57 | 58 | protected virtual void Dispose(bool disposing) 59 | { 60 | if (disposing) 61 | { 62 | // get rid of managed resources 63 | } 64 | 65 | Stop(); 66 | } 67 | 68 | ~MouseHook() 69 | { 70 | Dispose(false); 71 | } 72 | 73 | private int HookProc(int code, int wParam, IntPtr lParam) 74 | { 75 | if (code == HC_ACTION) 76 | { 77 | if ((MouseButton == MouseButton.Left && wParam == WM_LBUTTONDOWN) || 78 | (MouseButton == MouseButton.Right && wParam == WM_RBUTTONDOWN) || 79 | (MouseButton == MouseButton.Middle && wParam == WM_MBUTTONDOWN)) 80 | { 81 | var key1 = true; 82 | var key2 = true; 83 | var key3 = true; 84 | var key4 = true; 85 | 86 | if (Key1 != VirtualKeyModifier.None) 87 | { 88 | var keyState = GetAsyncKeyState((int)Key1) & 0x8000; 89 | key1 = Convert.ToBoolean(keyState); 90 | } 91 | 92 | if (Key2 != VirtualKeyModifier.None) 93 | { 94 | var keyState = GetAsyncKeyState((int)Key2) & 0x8000; 95 | key2 = Convert.ToBoolean(keyState); 96 | } 97 | 98 | if (Key3 != VirtualKey.None) 99 | { 100 | var keyState = GetAsyncKeyState((int)Key3) & 0x8000; 101 | key3 = Convert.ToBoolean(keyState); 102 | } 103 | 104 | if (Key4 != VirtualKey.None) 105 | { 106 | var keyState = GetAsyncKeyState((int)Key4) & 0x8000; 107 | key4 = Convert.ToBoolean(keyState); 108 | } 109 | 110 | if (key1 && key2 && key3 && key4) 111 | { 112 | var handler = Hooked; 113 | if (handler != null) 114 | { 115 | handler.BeginInvoke(this, EventArgs.Empty, null, null); 116 | return 1; 117 | } 118 | } 119 | } 120 | 121 | if (MouseButton != MouseButton.None && wParam == WM_LBUTTONDOWN) 122 | { 123 | var handler = ClickHooked; 124 | if (handler != null) 125 | { 126 | handler.BeginInvoke(this, EventArgs.Empty, null, null); 127 | } 128 | } 129 | } 130 | 131 | return CallNextHookEx(_hookHandle, code, wParam, lParam); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/SizeSettingsForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using SmartContextMenu.Settings; 6 | using SmartContextMenu.Hooks; 7 | using SmartContextMenu.Extensions; 8 | 9 | namespace SmartContextMenu.Forms 10 | { 11 | partial class SizeSettingsForm : Form 12 | { 13 | public WindowSizeMenuItem MenuItem { get; private set; } 14 | 15 | public SizeSettingsForm(LanguageManager manager, WindowSizeMenuItem menuItem) 16 | { 17 | MenuItem = menuItem; 18 | InitializeComponent(); 19 | InitializeControls(manager, menuItem); 20 | } 21 | 22 | private void InitializeControls(LanguageManager manager, WindowSizeMenuItem menuItem) 23 | { 24 | lblTitle.Text = manager.GetString("lbl_window_size_title"); 25 | lblLeft.Text = manager.GetString("lbl_window_size_left"); 26 | lblTop.Text = manager.GetString("lbl_window_size_top"); 27 | lblWidth.Text = manager.GetString("lbl_window_size_width"); 28 | lblHeight.Text = manager.GetString("lbl_window_size_height"); 29 | lblKey1.Text = manager.GetString("lbl_window_size_key1"); 30 | lblKey2.Text = manager.GetString("lbl_window_size_key2"); 31 | lblKey3.Text = manager.GetString("lbl_window_size_key3"); 32 | btnApply.Text = manager.GetString("window_size_btn_apply"); 33 | btnCancel.Text = manager.GetString("window_size_btn_cancel"); 34 | Text = manager.GetString("window_size_form"); 35 | 36 | txtTitle.Text = menuItem.Title; 37 | txtLeft.Text = menuItem.Left == null ? string.Empty : menuItem.Left.Value.ToString(); 38 | txtTop.Text = menuItem.Top == null ? string.Empty : menuItem.Top.Value.ToString(); 39 | txtWidth.Text = menuItem.Width == null ? string.Empty : menuItem.Width.ToString(); 40 | txtHeight.Text = menuItem.Height == null ? string.Empty : menuItem.Height.ToString(); 41 | 42 | cmbKey1.ValueMember = "Id"; 43 | cmbKey1.DisplayMember = "Text"; 44 | cmbKey1.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 45 | cmbKey1.SelectedValue = menuItem.Key1; 46 | 47 | cmbKey2.ValueMember = "Id"; 48 | cmbKey2.DisplayMember = "Text"; 49 | cmbKey2.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 50 | cmbKey2.SelectedValue = menuItem.Key2; 51 | 52 | cmbKey3.ValueMember = "Id"; 53 | cmbKey3.DisplayMember = "Text"; 54 | cmbKey3.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 55 | cmbKey3.SelectedValue = menuItem.Key3; 56 | } 57 | 58 | protected override void OnLoad(EventArgs e) 59 | { 60 | base.OnLoad(e); 61 | 62 | txtTitle.SelectAll(); 63 | txtTitle.Focus(); 64 | } 65 | 66 | private void ButtonApplyClick(object sender, EventArgs e) 67 | { 68 | if (string.IsNullOrWhiteSpace(txtTitle.Text)) 69 | { 70 | txtTitle.SelectAll(); 71 | txtTitle.Focus(); 72 | return; 73 | } 74 | 75 | var menuItem = new WindowSizeMenuItem(); 76 | menuItem.Title = txtTitle.Text; 77 | menuItem.Key1 = (VirtualKeyModifier)cmbKey1.SelectedValue; 78 | menuItem.Key2 = (VirtualKeyModifier)cmbKey2.SelectedValue; 79 | menuItem.Key3 = (VirtualKey)cmbKey3.SelectedValue; 80 | 81 | menuItem.Width = int.TryParse(txtWidth.Text, out var width) ? width : null; 82 | menuItem.Height = int.TryParse(txtHeight.Text, out var height) ? height : null; 83 | menuItem.Left = int.TryParse(txtLeft.Text, out var left) ? left : null; 84 | menuItem.Top = int.TryParse(txtTop.Text, out var top) ? top : null; 85 | 86 | MenuItem = menuItem; 87 | DialogResult = DialogResult.OK; 88 | Close(); 89 | } 90 | 91 | private void ButtonCancelClick(object sender, EventArgs e) 92 | { 93 | DialogResult = DialogResult.Cancel; 94 | Close(); 95 | } 96 | 97 | private void FormKeyDown(object sender, KeyEventArgs e) 98 | { 99 | if (e.KeyValue == 13) 100 | { 101 | ButtonApplyClick(sender, e); 102 | } 103 | 104 | if (e.KeyValue == 27) 105 | { 106 | ButtonCancelClick(sender, e); 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /SmartContextMenu/MenuItemName.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu 2 | { 3 | static class MenuItemName 4 | { 5 | public const string Information = "information"; 6 | 7 | public const string RollUp = "roll_up"; 8 | 9 | public const string AeroGlass = "aero_glass"; 10 | 11 | public const string Borderless = "borderless"; 12 | 13 | public const string Dimmer = "dimmer"; 14 | 15 | public const string Hide = "hide"; 16 | 17 | public const string ChangeIcon = "change_icon"; 18 | 19 | public const string ChangeTitle = "change_title"; 20 | 21 | public const string AlwaysOnTop = "always_on_top"; 22 | 23 | public const string SendToBottom = "send_to_bottom"; 24 | 25 | public const string SaveScreenshot = "save_screenshot"; 26 | 27 | public const string OpenFileInExplorer = "open_file_in_explorer"; 28 | 29 | public const string ClickThrough = "click_through"; 30 | 31 | public const string HideForAltTab = "hide_for_alt_tab"; 32 | 33 | public const string Size = "size"; 34 | 35 | public const string SizeCustom = "size_custom"; 36 | 37 | public const string MoveTo = "move_to"; 38 | 39 | public const string AlignTopLeft = "align_top_left"; 40 | 41 | public const string AlignTopCenter = "align_top_center"; 42 | 43 | public const string AlignTopRight = "align_top_right"; 44 | 45 | public const string AlignMiddleLeft = "align_middle_left"; 46 | 47 | public const string AlignMiddleCenter = "align_middle_center"; 48 | 49 | public const string AlignMiddleRight = "align_middle_right"; 50 | 51 | public const string AlignBottomLeft = "align_bottom_left"; 52 | 53 | public const string AlignBottomCenter = "align_bottom_center"; 54 | 55 | public const string AlignBottomRight = "align_bottom_right"; 56 | 57 | public const string AlignCenterHorizontally = "align_center_horizontally"; 58 | 59 | public const string AlignCenterVertically = "align_center_vertically"; 60 | 61 | public const string AlignCustom = "align_custom"; 62 | 63 | public const string Transparency = "transparency"; 64 | 65 | public const string TransparencyOpaque = "trans_opaque"; 66 | 67 | public const string Transparency10 = "trans_10"; 68 | 69 | public const string Transparency20 = "trans_20"; 70 | 71 | public const string Transparency30 = "trans_30"; 72 | 73 | public const string Transparency40 = "trans_40"; 74 | 75 | public const string Transparency50 = "trans_50"; 76 | 77 | public const string Transparency60 = "trans_60"; 78 | 79 | public const string Transparency70 = "trans_70"; 80 | 81 | public const string Transparency80 = "trans_80"; 82 | 83 | public const string Transparency90 = "trans_90"; 84 | 85 | public const string TransparencyInvisible = "trans_invisible"; 86 | 87 | public const string TransparencyCustom = "trans_custom"; 88 | 89 | public const string PriorityRealTime = "priority_real_time"; 90 | 91 | public const string PriorityHigh = "priority_high"; 92 | 93 | public const string PriorityAboveNormal = "priority_above_normal"; 94 | 95 | public const string PriorityNormal = "priority_normal"; 96 | 97 | public const string PriorityBelowNormal = "priority_below_normal"; 98 | 99 | public const string PriorityIdle = "priority_idle"; 100 | 101 | public const string CopyScreenshot = "copy_screenshot"; 102 | 103 | public const string CopyWindowText = "copy_window_text"; 104 | 105 | public const string CopyWindowTitle = "copy_window_title"; 106 | 107 | public const string CopyFullProcessPath = "copy_full_process_path"; 108 | 109 | public const string ClearСlipboard = "clear_clipboard"; 110 | 111 | public const string DisableMinimizeButton = "disable_minimize_button"; 112 | 113 | public const string DisableMaximizeButton = "disable_maximize_button"; 114 | 115 | public const string DisableCloseButton = "disable_close_button"; 116 | 117 | public const string SystemMenuRestore = "system_menu_restore"; 118 | 119 | public const string SystemMenuMinimize = "system_menu_minimize"; 120 | 121 | public const string SystemMenuMaximize = "system_menu_maximize"; 122 | 123 | public const string SystemMenuClose = "system_menu_close"; 124 | 125 | public const string SystemMenuAvailable = "system_menu_available"; 126 | 127 | public const string MinimizeToSystemtray = "minimize_to_systemtray"; 128 | 129 | public const string MinimizeAlwaysToSystemtray = "minimize_always_to_systemtray"; 130 | 131 | public const string SuspendToSystemtray = "suspend_to_systemtray"; 132 | 133 | public const string MinimizeOtherWindows = "minimize_other_windows"; 134 | 135 | public const string CloseOtherWindows = "close_other_windows"; 136 | 137 | public const string StartProgram = "start_program"; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /README_RU.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | logo 4 | 5 | # SmartContextMenu 6 | 7 |
8 | 9 | 🌏: [English](/) [**Русский**](/README_RU.md) [中文版](/README_CN.md) [한국어](/README_KO.md) 10 | 11 | --- 12 | 13 | SmartContextMenu добавляет контекстное меню для всех окон в Вашей ОС. 14 | Эта программа является улучшенной версией [SmartSystemMenu](https://github.com/AlexanderPro/SmartSystemMenu). 15 | Надеюсь она будет более удобной в использовании, т.к. поддерживает работу со всеми окнами, включая и окна без системного меню. 16 | Так же она должна быть более стабильной и легковесной, т.к. не использует хуки в отдельных dll модулях. 17 | Для использования приложения необходимо запустить файл SmartContextMenu.exe, навести указатель мыши на нужное окно и воспользоваться комбинацией клавиш “**Ctrl + Правая Кнопка Мыши**”. 18 | Все настройки меню и быстрые клавиши, можно менять в интерфейсе приложения в системном трее, а так же в файле SmartContextMenu.xml. Доступные пункты меню: 19 | 20 | * **Информация.** Отображает диалог с детальной информацией об окне и процессе, которому принадлежит окно. 21 | * **Aero Glass.** Включает для текущего окна режим "Aero Glass". (Поддерживается в Windows Vista and выше. Удобно по большей части для консольных окон.) 22 | * **Поверх остальных.** Отображает окно поверх остальных окон системы. 23 | * **Без рамки.** Позволяет отобразить окно в безрамочном режиме. Может быть полезно для оконных игр. 24 | * **Затемнение.** Затемняет монитор, кроме активного окна. 25 | * **Скрыть.** Позволяет скрыть окно. 26 | * **Свернуть вверх.** Позволяет свернуть вверх до заголовка окно и обратно. 27 | * **Переместить вниз.** Отображает окно за всеми окнами системы. 28 | * **Изменить иконку.** Позволяет изменить иконку окна. 29 | * **Изменить заголовок.** Позволяет изменить заголовок окна. 30 | * **Сохранить снимок окна.** Позволяет сохранить скриншот окна в файл. 31 | * **Открыть в проводнике.** Открывает File Explorer с выделенным файлом процесса, которому принадлежит окно. 32 | * **Клик сквозь окно.** Позволяет выполнить клик сквозь окно. 33 | * **Скрыть для Alt+Tab.** Позволяет скрыть окно на панели задач и при переключении Alt+Tab. 34 | * **Изменить размер.** Позволяет изменить размер окна. 35 | * **Переместить.** Позволяет перенести окно на другой монитор. 36 | * **Выравнивание.** Позволяет выравнить окно в одной из 9 позиций. 37 | * **Прозрачность.** Позволяет изменить прозрачность окна. 38 | * **Приоритет.** Позволяет изменить приоритет процесса, которому принадлежит окно. 39 | * **Буфер обмена.** Позволяет скопировать текст окна в буфер обмена или очистить буфер обмена. 40 | * **Кнопки.** Позволяет отключить кнопки минимизации, максимизации и закрытия окна. 41 | * **Системный трей.** Сворачивает окно в системный трей. 42 | * **Системное меню.** Содержит элементы системного меню. 43 | * **Другие окна.** Позволяет закрыть или минимизировать все окна системы кроме текущего. 44 | * **Пуск.** Запускает любой процесс заданный через настройки программы. 45 | 46 | Скриншоты 47 | ------------------ 48 | 49 | ![Resize](./SmartContextMenu/Images/SmartContextMenuRu1.png) 50 | ![Alignment](./SmartContextMenu/Images/SmartContextMenuRu2.png) 51 | ![System Menu](./SmartContextMenu/Images/SmartContextMenuRu3.png) 52 | 53 | Интерфейс командной строки 54 | -------------------- 55 | 56 | ```bash 57 | --help The help 58 | --title Title 59 | --titleBegins Title begins 60 | --titleEnds Title ends 61 | --titleContains Title contains 62 | --handle Handle (1234567890) (0xFFFFFF) 63 | --processId PID (1234567890) 64 | -d --delay Delay in milliseconds 65 | -l --left Left 66 | -t --top Top 67 | -w --width Width 68 | -h --height Height 69 | -i --information Information dialog 70 | -s --savescreenshot Save Screenshot 71 | -m --monitor [0, 1, 2, 3, ...] 72 | -a --alignment [topleft, 73 | topcenter, 74 | topright, 75 | middleleft, 76 | middlecenter, 77 | middleright, 78 | bottomleft, 79 | bottomcenter, 80 | bottomright, 81 | centerhorizontally, 82 | centervertically] 83 | -p --priority [realtime, 84 | high, 85 | abovenormal, 86 | normal, 87 | belownormal, 88 | idle] 89 | --systemmenu [restore, 90 | minimize, 91 | maximize, 92 | close] 93 | --transparency [0 ... 100] 94 | --alwaysontop [on, off] 95 | -g --aeroglass [on, off] 96 | --hide [on, off] 97 | --hidealttab [on, off] 98 | --clickthrough [on, off] 99 | --minimizebutton [on, off] 100 | --maximizebutton [on, off] 101 | --sendtobottom Send To Bottom 102 | -b --borderless Borderless 103 | -r --rollup Roll Up 104 | -o --openinexplorer Open File In Explorer 105 | -c --copytoclipboard Copy Window Text To Clipboard 106 | --copyscreenshot Copy Screenshot To Clipboard 107 | --clearclipboard Clear Clipboard 108 | -n --nogui No GUI 109 | 110 | Example: 111 | SmartContextMenu.exe --title "Untitled - Notepad" -a topleft -p high --alwaysontop on --nogui 112 | ``` 113 | 114 | Установка 115 | -------------------- 116 | 117 | * Скачайте последнюю версию [SmartContextMenu](https://github.com/AlexanderPro/SmartContextMenu/releases) в zip файле 118 | * [Chocolatey](https://chocolatey.org/): `choco install smartcontextmenu` 119 | * [Scoop](https://scoop.sh/): `scoop bucket add extras` и `scoop install extras/smartcontextmenu` 120 | 121 | Требования к системе 122 | -------------------- 123 | 124 | * ОС Windows XP SP3 и выше. Поддержка x86 и x64 систем. 125 | * .NET Framework 4.0 и выше. 126 | 127 | Файлы 128 | -------------------- 129 | 130 | * SmartContextMenu.exe 131 | * SmartContextMenu.xml (Располагается в каталоге профиля пользователя. Если планируете использовать приложение как портативное, то скопируйте этот файл в каталог где лежит SmartContextMenu.exe) 132 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/AboutForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class AboutForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | /// Contains language strings. 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm)); 33 | this.lblProductName = new System.Windows.Forms.Label(); 34 | this.lblCopyright = new System.Windows.Forms.Label(); 35 | this.linkUrl = new System.Windows.Forms.LinkLabel(); 36 | this.btnOk = new System.Windows.Forms.Button(); 37 | this.pbImage = new System.Windows.Forms.PictureBox(); 38 | ((System.ComponentModel.ISupportInitialize)(this.pbImage)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // lblProductName 42 | // 43 | this.lblProductName.AutoSize = true; 44 | this.lblProductName.Location = new System.Drawing.Point(152, 37); 45 | this.lblProductName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 46 | this.lblProductName.Name = "lblProductName"; 47 | this.lblProductName.Size = new System.Drawing.Size(98, 17); 48 | this.lblProductName.TabIndex = 0; 49 | this.lblProductName.Text = "Product Name"; 50 | // 51 | // lblCopyright 52 | // 53 | this.lblCopyright.AutoSize = true; 54 | this.lblCopyright.Location = new System.Drawing.Point(152, 64); 55 | this.lblCopyright.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 56 | this.lblCopyright.Name = "lblCopyright"; 57 | this.lblCopyright.Size = new System.Drawing.Size(68, 17); 58 | this.lblCopyright.TabIndex = 1; 59 | this.lblCopyright.Text = "Copyright"; 60 | // 61 | // linkUrl 62 | // 63 | this.linkUrl.AutoSize = true; 64 | this.linkUrl.Location = new System.Drawing.Point(152, 92); 65 | this.linkUrl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 66 | this.linkUrl.Name = "linkUrl"; 67 | this.linkUrl.Size = new System.Drawing.Size(36, 17); 68 | this.linkUrl.TabIndex = 2; 69 | this.linkUrl.TabStop = true; 70 | this.linkUrl.Text = "URL"; 71 | this.linkUrl.Click += new System.EventHandler(this.LinkClick); 72 | // 73 | // btnOk 74 | // 75 | this.btnOk.Location = new System.Drawing.Point(521, 37); 76 | this.btnOk.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 77 | this.btnOk.Name = "btnOk"; 78 | this.btnOk.Size = new System.Drawing.Size(115, 37); 79 | this.btnOk.TabIndex = 3; 80 | this.btnOk.UseVisualStyleBackColor = true; 81 | this.btnOk.Click += new System.EventHandler(this.ButtonOkClick); 82 | // 83 | // pbImage 84 | // 85 | this.pbImage.BackgroundImage = global::SmartContextMenu.Properties.Resources.SmartContextMenuImage; 86 | this.pbImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; 87 | this.pbImage.InitialImage = null; 88 | this.pbImage.Location = new System.Drawing.Point(5, 26); 89 | this.pbImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 90 | this.pbImage.Name = "pbImage"; 91 | this.pbImage.Size = new System.Drawing.Size(139, 124); 92 | this.pbImage.TabIndex = 4; 93 | this.pbImage.TabStop = false; 94 | // 95 | // AboutForm 96 | // 97 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 98 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 99 | this.ClientSize = new System.Drawing.Size(649, 176); 100 | this.Controls.Add(this.pbImage); 101 | this.Controls.Add(this.btnOk); 102 | this.Controls.Add(this.linkUrl); 103 | this.Controls.Add(this.lblCopyright); 104 | this.Controls.Add(this.lblProductName); 105 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 106 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 107 | this.KeyPreview = true; 108 | this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 109 | this.MaximizeBox = false; 110 | this.MinimizeBox = false; 111 | this.Name = "AboutForm"; 112 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 113 | this.Text = "About"; 114 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.KeyDownClick); 115 | ((System.ComponentModel.ISupportInitialize)(this.pbImage)).EndInit(); 116 | this.ResumeLayout(false); 117 | this.PerformLayout(); 118 | 119 | } 120 | 121 | #endregion 122 | 123 | private System.Windows.Forms.Label lblProductName; 124 | private System.Windows.Forms.Label lblCopyright; 125 | private System.Windows.Forms.LinkLabel linkUrl; 126 | private System.Windows.Forms.Button btnOk; 127 | private System.Windows.Forms.PictureBox pbImage; 128 | } 129 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | logo 4 | 5 | # SmartContextMenu 6 | 7 |
8 | 9 | 🌏: [**English**](/) [Русский](/README_RU.md) [中文版](/README_CN.md) [한국어](/README_KO.md) 10 | 11 | --- 12 | 13 | SmartContextMenu adds a context menu to all windows in the system. 14 | This program is enhanced version of [SmartSystemMenu](https://github.com/AlexanderPro/SmartSystemMenu). 15 | I hope it will be more convenient, because it supports all types of windows, including windows without a system menu. 16 | It should also be more stable and lightweight, as it does not use hooks in separate dll modules. 17 | To use the app, please, run the file SmartContextMenu.exe, move the mouse cursor to the necessary window and use the hotkeys “**Ctrl + Right Mouse Button**”. 18 | All the menu settings and hotkeys can be changed in the settings dialog of the system tray, as well as in the file SmartContextMenu.xml. 19 | Available menu items: 20 | 21 | * **Information.** Shows a dialog with information of the current window and process: the window handle, the window caption, the window style, the window class, the process name, the process id, the path to the process. 22 | * **Aero Glass.** Allows to add the "Aero Glass" blur to the current window. (Windows Vista and higher. Mostly for console windows.) 23 | * **Always On Top.** Allows the current window to stay on top of all other windows. 24 | * **Borderless.** Allows you to turn your windowed games into "Borderless" mode. 25 | * **Dimmer.** Dims all but the currently focused window. 26 | * **Hide.** Allows to hide the current window. 27 | * **Roll Up.** Allows to roll up and down the current window. 28 | * **Send To Bottom.** Allows to send to bottom the current window. 29 | * **Change Icon.** Allows to change the icon of the current window. 30 | * **Change Title.** Allows to change the text in the title bar. 31 | * **Save Screenshot.** Allows to save the current window screenshot in a file. 32 | * **Open File In Explorer.** Allows to open a process file in a File Explorer. 33 | * **Click Through.** Allows to click through the current window. 34 | * **Hide For Alt+Tab.** Allows to hide the current window for the Taskbar and Alt+Tab switch. 35 | * **Resize.** Allows to change the size of the current window. 36 | * **Move To.** Allows to move the current window to another monitor. 37 | * **Alignment.** Allows the current window to be aligned with any of the 9 positions on the desktop. 38 | * **Transparency.** Allows to change the transparency of the current window. 39 | * **Priority.** Allows to change the current window's program priority. 40 | * **Clipboard.** Allows to copy all window texts (including console, ms office products, etc.) to clipboard and clear clipboard. 41 | * **Buttons.** Allows to disable "Minimize", "Maximize" and "Close" button. 42 | * **System Tray.** Allows to minimize or suspend the current window to the system tray. 43 | * **System Menu.** Contains System Menu items. 44 | * **Other Windows.** Allows to close and minimize all windows in the system except the current. 45 | * **Start Program.** Allows to start programs which is in the settings. 46 | 47 | Screenshots 48 | ------------------ 49 | 50 | ![Resize](./SmartContextMenu/Images/SmartContextMenuEn1.png) 51 | ![Alignment](./SmartContextMenu/Images/SmartContextMenuEn2.png) 52 | ![System Menu](./SmartContextMenu/Images/SmartContextMenuEn3.png) 53 | 54 | Command Line Interface 55 | -------------------- 56 | 57 | ```bash 58 | --help The help 59 | --title Title 60 | --titleBegins Title begins 61 | --titleEnds Title ends 62 | --titleContains Title contains 63 | --handle Handle (1234567890) (0xFFFFFF) 64 | --processId PID (1234567890) 65 | -d --delay Delay in milliseconds 66 | -l --left Left 67 | -t --top Top 68 | -w --width Width 69 | -h --height Height 70 | -i --information Information dialog 71 | -s --savescreenshot Save Screenshot 72 | -m --monitor [0, 1, 2, 3, ...] 73 | -a --alignment [topleft, 74 | topcenter, 75 | topright, 76 | middleleft, 77 | middlecenter, 78 | middleright, 79 | bottomleft, 80 | bottomcenter, 81 | bottomright, 82 | centerhorizontally, 83 | centervertically] 84 | -p --priority [realtime, 85 | high, 86 | abovenormal, 87 | normal, 88 | belownormal, 89 | idle] 90 | --systemmenu [restore, 91 | minimize, 92 | maximize, 93 | close] 94 | --transparency [0 ... 100] 95 | --alwaysontop [on, off] 96 | -g --aeroglass [on, off] 97 | --hide [on, off] 98 | --hidealttab [on, off] 99 | --clickthrough [on, off] 100 | --minimizebutton [on, off] 101 | --maximizebutton [on, off] 102 | --sendtobottom Send To Bottom 103 | -b --borderless Borderless 104 | -r --rollup Roll Up 105 | -o --openinexplorer Open File In Explorer 106 | -c --copytoclipboard Copy Window Text To Clipboard 107 | --copyscreenshot Copy Screenshot To Clipboard 108 | --clearclipboard Clear Clipboard 109 | -n --nogui No GUI 110 | 111 | Example: 112 | SmartContextMenu.exe --title "Untitled - Notepad" -a topleft -p high --alwaysontop on --nogui 113 | ``` 114 | 115 | Install 116 | -------------------- 117 | 118 | * Download the [SmartContextMenu](https://github.com/AlexanderPro/SmartContextMenu/releases) in the zip file 119 | * [Chocolatey](https://chocolatey.org/): `choco install smartcontextmenu` 120 | * [Scoop](https://scoop.sh/): `scoop bucket add extras` and `scoop install extras/smartcontextmenu` 121 | 122 | Requirements 123 | -------------------- 124 | 125 | * OS Windows XP SP3 and later. Supports x86 and x64 systems. 126 | * .NET Framework 4.0 127 | 128 | Files 129 | -------------------- 130 | 131 | * SmartContextMenu.exe 132 | * SmartContextMenu.xml (It is placed in roaming user directory. If you are planing to use SmartContextMenu as a portable app, then copy the file to the directory with SmartContextMenu.exe) 133 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/StartProgramForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using SmartContextMenu.Settings; 6 | using SmartContextMenu.Hooks; 7 | using SmartContextMenu.Extensions; 8 | 9 | 10 | namespace SmartContextMenu.Forms 11 | { 12 | public partial class StartProgramForm : Form 13 | { 14 | private readonly LanguageManager _languageManager; 15 | public StartProgramMenuItem MenuItem { get; private set; } 16 | 17 | public StartProgramForm(LanguageManager manager, StartProgramMenuItem menuItem) 18 | { 19 | _languageManager = manager; 20 | InitializeComponent(); 21 | InitializeControls(menuItem); 22 | } 23 | 24 | private void InitializeControls(StartProgramMenuItem menuItem) 25 | { 26 | lblTitle.Text = _languageManager.GetString("start_program_lbl_title"); 27 | btnApply.Text = _languageManager.GetString("start_program_btn_apply"); 28 | btnCancel.Text = _languageManager.GetString("start_program_btn_cancel"); 29 | lblFileName.Text = _languageManager.GetString("start_program_lbl_file_name"); 30 | lblArguments.Text = _languageManager.GetString("start_program_lbl_arguments"); 31 | lblBegin.Text = _languageManager.GetString("start_program_lbl_begin"); 32 | lblEnd.Text = _languageManager.GetString("start_program_lbl_end"); 33 | lblKey1.Text = _languageManager.GetString("start_program_lbl_key1"); 34 | lblKey2.Text = _languageManager.GetString("start_program_lbl_key2"); 35 | lblKey3.Text = _languageManager.GetString("start_program_lbl_key3"); 36 | chkShowWindow.Text = _languageManager.GetString("start_program_show_window"); 37 | chkUseWindowWorkingDirectory.Text = _languageManager.GetString("start_program_use_window_working_directory"); 38 | Text = _languageManager.GetString("start_program_form"); 39 | 40 | cmbKey1.ValueMember = "Id"; 41 | cmbKey1.DisplayMember = "Text"; 42 | cmbKey1.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 43 | 44 | cmbKey2.ValueMember = "Id"; 45 | cmbKey2.DisplayMember = "Text"; 46 | cmbKey2.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 47 | 48 | cmbKey3.ValueMember = "Id"; 49 | cmbKey3.DisplayMember = "Text"; 50 | cmbKey3.DataSource = EnumExtensions.AsEnumerable().Select(x => new { Id = x, Text = x.GetDescription() }).Where(x => !string.IsNullOrEmpty(x.Text)).ToList(); 51 | 52 | if (menuItem != null) 53 | { 54 | txtTitle.Text = menuItem.Title; 55 | txtFileName.Text = menuItem.FileName; 56 | txtArguments.Text = menuItem.Arguments; 57 | txtBegin.Text = menuItem.BeginParameter; 58 | txtEnd.Text = menuItem.EndParameter; 59 | txtParameter.Text = $"{menuItem.BeginParameter}{_languageManager.GetString("start_program_parameter")}{menuItem.EndParameter}"; 60 | chkShowWindow.Checked = menuItem.ShowWindow; 61 | chkUseWindowWorkingDirectory.Checked = menuItem.UseWindowWorkingDirectory; 62 | cmbKey1.SelectedValue = menuItem.Key1; 63 | cmbKey2.SelectedValue = menuItem.Key2; 64 | cmbKey3.SelectedValue = menuItem.Key3; 65 | } 66 | } 67 | 68 | protected override void OnLoad(EventArgs e) 69 | { 70 | base.OnLoad(e); 71 | 72 | txtTitle.SelectAll(); 73 | txtTitle.Focus(); 74 | } 75 | 76 | private void BeginParameterTextChanged(object sender, EventArgs e) 77 | { 78 | txtParameter.Text = $"{txtBegin.Text}{_languageManager.GetString("start_program_parameter")}{txtEnd.Text}"; 79 | } 80 | 81 | private void EndParameterTextChanged(object sender, EventArgs e) 82 | { 83 | txtParameter.Text = $"{txtBegin.Text}{_languageManager.GetString("start_program_parameter")}{txtEnd.Text}"; 84 | } 85 | 86 | private void ButtonBrowseFileClick(object sender, EventArgs e) 87 | { 88 | var dialog = new OpenFileDialog() 89 | { 90 | RestoreDirectory = true, 91 | Filter = _languageManager.GetString("start_program_browse_file_filter") 92 | }; 93 | 94 | if (File.Exists(txtFileName.Text)) 95 | { 96 | dialog.InitialDirectory = Path.GetDirectoryName(txtFileName.Text); 97 | } 98 | 99 | if (dialog.ShowDialog() == DialogResult.OK) 100 | { 101 | txtFileName.Text = dialog.FileName; 102 | } 103 | } 104 | 105 | private void ButtonApplyClick(object sender, EventArgs e) 106 | { 107 | MenuItem = new StartProgramMenuItem 108 | { 109 | Title = txtTitle.Text, 110 | FileName = txtFileName.Text, 111 | Arguments = txtArguments.Text, 112 | BeginParameter = txtBegin.Text, 113 | EndParameter = txtEnd.Text, 114 | ShowWindow = chkShowWindow.Checked, 115 | UseWindowWorkingDirectory = chkUseWindowWorkingDirectory.Checked, 116 | Key1 = (VirtualKeyModifier)cmbKey1.SelectedValue, 117 | Key2 = (VirtualKeyModifier)cmbKey2.SelectedValue, 118 | Key3 = (VirtualKey)cmbKey3.SelectedValue 119 | }; 120 | DialogResult = DialogResult.OK; 121 | Close(); 122 | } 123 | 124 | private void ButtonCancelClick(object sender, EventArgs e) 125 | { 126 | DialogResult = DialogResult.Cancel; 127 | Close(); 128 | } 129 | 130 | private void KeyDownClick(object sender, KeyEventArgs e) 131 | { 132 | if (e.KeyValue == 13) 133 | { 134 | ButtonApplyClick(sender, e); 135 | } 136 | 137 | if (e.KeyValue == 27) 138 | { 139 | ButtonCancelClick(sender, e); 140 | } 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /Package/Chocolatey/smartcontextmenu.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | smartcontextmenu 26 | 27 | 28 | 29 | 1.7.2 30 | https://github.com/AlexanderPro/SmartContextMenu/tree/master/Package/Chocolatey 31 | 32 | AlexanderPro 33 | 34 | 35 | 36 | 37 | SmartContextMenu 38 | Alexander Illarionov 39 | 40 | https://github.com/AlexanderPro/SmartContextMenu 41 | https://rawcdn.githack.com/AlexanderPro/SmartContextMenu/4800c92b43b80f43b132c557d5ca2d727340779b/Package/Chocolatey/icon.png 42 | 43 | 44 | https://github.com/AlexanderPro/SmartContextMenu/blob/master/LICENSE 45 | true 46 | https://github.com/AlexanderPro/SmartContextMenu 47 | https://github.com/AlexanderPro/SmartContextMenu 48 | 49 | https://github.com/AlexanderPro/SmartContextMenu/issues 50 | clipboard rollup menu aero alignment context-menu transparency always-on-top powermenu window-screenshot minimize-to-system-tray window-resize click-through systemmenu aeroglass 51 | Smart context menu for all windows in the system 52 | SmartContextMenu adds a context menu to all windows in the system. This program is enhanced version of SmartSystemMenu. I hope it will be more convenient, because it supports all types of windows, including windows without a system menu. It should also be more stable and lightweight, as it does not use hooks in separate dll modules. To use the app, please, run the file SmartContextMenu.exe, move the mouse cursor to the necessary window and use the hotkeys “Ctrl + Right Mouse Button”. All the menu settings and hotkeys can be changed in the settings dialog of the system tray, as well as in the file SmartContextMenu.xml. 53 | 54 | 55 | 56 | 57 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /SmartContextMenu/Native/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Native 2 | { 3 | static class Constants 4 | { 5 | // System Menu 6 | public const int SC_MOVE = 0xF010; 7 | public const int SC_MINIMIZE = 0xF020; 8 | public const int SC_MAXIMIZE = 0xF030; 9 | public const int SC_RESTORE = 0xF120; 10 | public const int SC_RESIZE = 0xF000; 11 | public const int SC_CLOSE = 0xF060; 12 | 13 | // Menu 14 | public const int MF_UNCHECKED = 0x00000000; 15 | public const int MF_STRING = 0x00000000; 16 | public const int MF_ENABLED = 0x00000000; 17 | public const int MF_GRAYED = 0x00000001; 18 | public const int MF_DISABLED = 0x00000002; 19 | public const int MF_CHECKED = 0x00000008; 20 | public const int MF_POPUP = 0x00000010; 21 | public const int MF_BYCOMMAND = 0x00000000; 22 | public const int MF_BYPOSITION = 0x00000400; 23 | public const int MF_SEPARATOR = 0x00000800; 24 | 25 | // GetWindow 26 | public const int GW_HWNDFIRST = 0; 27 | public const int GW_OWNER = 4; 28 | public const int GW_CHILD = 5; 29 | 30 | // LayeredWindowAttributes 31 | public const int LWA_COLORKEY = 0x00000001; 32 | public const int LWA_ALPHA = 0x00000002; 33 | 34 | // WindowLong 35 | public const int GWL_WNDPROC = -4; 36 | public const int GWL_HINSTANCE = -6; 37 | public const int GWL_HWNDPARENT = -8; 38 | public const int GWL_STYLE = -16; 39 | public const int GWL_EXSTYLE = -20; 40 | public const int GWL_USERDATA = -21; 41 | public const int GWL_ID = -12; 42 | 43 | // ClassLong 44 | public const int GCL_STYLE = -26; 45 | public const int GCL_WNDPROC = -24; 46 | public const int DWL_DLGPROC = 4; 47 | public const int DWL_USER = 8; 48 | 49 | // WindowStyle 50 | public const long WS_CAPTION = 0x00C00000L; 51 | public const long WS_SYSMENU = 0x00080000L; 52 | public const long WS_POPUP = 0x80000000L; 53 | public const long WS_MAXIMIZEBOX = 0x00010000L; 54 | public const long WS_MINIMIZEBOX = 0x00020000L; 55 | public const long WS_THICKFRAME = 0x00040000L; 56 | public const long WS_EX_APPWINDOW = 0x00040000L; 57 | public const long WS_EX_CLIENTEDGE = 0x00000200L; 58 | public const long WS_EX_COMPOSITED = 0x02000000L; 59 | public const long WS_EX_DLGMODALFRAME = 0x00000001L; 60 | public const long WS_EX_LAYERED = 0x00080000L; 61 | public const long WS_EX_TOPMOST = 0x00000008L; 62 | public const long WS_EX_STATICEDGE = 0x00020000L; 63 | public const long WS_EX_TOOLWINDOW = 0x00000080L; 64 | public const long WS_EX_TRANSPARENT = 0x00000020L; 65 | public const long WS_EX_NOACTIVATE = 0x08000000L; 66 | public const long WS_EX_WINDOWEDGE = 0x00000100L; 67 | 68 | // Window Messages 69 | public const int WM_GETICON = 0x7F; 70 | public const int WM_SETICON = 0x0080; 71 | public const int WM_CLOSE = 0x0010; 72 | public const int WM_NULL = 0x0000; 73 | public const int WM_KEYDOWN = 0x0100; 74 | public const int WM_SYSKEYDOWN = 0x0104; 75 | public const int WM_GETTEXT = 0x000D; 76 | public const int WM_GETTEXTLENGTH = 0x000E; 77 | public const int WM_GETFONT = 0x0031; 78 | public const int WM_SYSCOMMAND = 0x0112; 79 | public const int WM_MOUSEMOVE = 0x0200; 80 | public const int WM_LBUTTONDOWN = 0x0201; 81 | public const int WM_LBUTTONUP = 0x0202; 82 | public const int WM_RBUTTONDOWN = 0x0204; 83 | public const int WM_RBUTTONUP = 0x0205; 84 | public const int WM_MBUTTONDOWN = 0x0207; 85 | public const int WM_MBUTTONUP = 0x0208; 86 | public const int WM_APP = 0x8000; 87 | 88 | // SetWindowPos 89 | public const uint SWP_NOSIZE = 0x0001; 90 | public const uint SWP_NOMOVE = 0x0002; 91 | public const uint SWP_NOACTIVATE = 0x0010; 92 | 93 | // MonitorFromWindow 94 | public const uint MONITOR_DEFAULTTONULL = 0; 95 | public const uint MONITOR_DEFAULTTOPRIMARY = 1; 96 | public const uint MONITOR_DEFAULTTONEAREST = 2; 97 | 98 | // SendMessageTimeoutFlags 99 | public const uint SMTO_NORMAL = 0x0000; 100 | public const uint SMTO_BLOCK = 0x0001; 101 | public const uint SMTO_ABORTIFHUNG = 0x0002; 102 | public const uint SMTO_NOTIMEOUTIFNOTHUNG = 0x0008; 103 | 104 | // GetAncestorFlags 105 | public const int GetParent = 1; 106 | public const int GetRoot = 2; 107 | public const int GetRootOwner = 3; 108 | 109 | public const int ICON_SMALL = 0; 110 | public const int ICON_BIG = 1; 111 | public const int ICON_SMALL2 = 2; 112 | public const int GCLP_HICON = -14; 113 | public const int GCLP_HICONSM = -34; 114 | public const string IDI_APPLICATION = "#32512"; 115 | 116 | public const int SW_HIDE = 0x0; 117 | public const int SW_MAXIMIZE = 0x3; 118 | public const int SW_MINIMIZE = 0x6; 119 | 120 | public const int WH_KEYBOARD_LL = 0x0D; 121 | public const int WH_MOUSE_LL = 0x0E; 122 | public const uint HC_ACTION = 0; 123 | 124 | public const int PROCESS_TERMINATE = 0x0001; 125 | public const int PROCESS_SET_INFORMATION = 0x0200; 126 | public const int PROCESS_QUERY_INFORMATION = 0x0400; 127 | public const int PROCESS_QUERY_LIMITED_INFORMATION = 0x1000; 128 | public const int PROCESS_VM_READ = 0x10; 129 | 130 | public const int STD_OUTPUT_HANDLE = -11; 131 | 132 | public const int DWMWA_EXTENDED_FRAME_BOUNDS = 9; 133 | public const int CREATE_NO_WINDOW = 0x08000000; 134 | public const int STARTF_USESHOWWINDOW = 0x00000001; 135 | 136 | public const int STATE_SYSTEM_INVISIBLE = 0x00008000; 137 | public const int SE_PRIVILEGE_ENABLED = 0x02; 138 | public const int SEND_CHILD_HANDLE = 1; 139 | 140 | public const uint WINEVENT_OUTOFCONTEXT = 0; 141 | public const uint EVENT_SYSTEM_MINIMIZESTART = 0x0016; 142 | public const uint EVENT_SYSTEM_MINIMIZEEND = 0x0017; 143 | public const uint EVENT_SYSTEM_FOREGROUND = 3; 144 | public const uint EVENT_OBJECT_DESTROY = 0x8001; 145 | public const int OBJID_WINDOW = 0; 146 | 147 | public const int CURSOR_SHOWING = 0x00000001; 148 | 149 | public const int DI_COMPAT = 0x0004; 150 | public const int DI_NORMAL = 0x0003; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/InformationForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Globalization; 4 | 5 | namespace SmartContextMenu.Forms 6 | { 7 | partial class InformationForm : Form 8 | { 9 | public InformationForm(LanguageManager manager, WindowDetails windowDetails) 10 | { 11 | InitializeComponent(); 12 | InitializeControls(manager, windowDetails); 13 | } 14 | 15 | private void InitializeControls(LanguageManager manager, WindowDetails windowDetails) 16 | { 17 | grpWindow.Text = manager.GetString("grp_window"); 18 | grpProcess.Text = manager.GetString("grp_process"); 19 | lblGetWindowText.Text = manager.GetString("lbl_get_window_text"); 20 | lblWmGetText.Text = manager.GetString("lbl_wm_gettext"); 21 | lblGetClassName.Text = manager.GetString("lbl_get_class_name"); 22 | lblRealGetWindowClass.Text = manager.GetString("lbl_real_get_window_class"); 23 | lblFontName.Text = manager.GetString("lbl_font_name"); 24 | lblWindowHandle.Text = manager.GetString("lbl_window_handle"); 25 | lblParentWindowHandle.Text = manager.GetString("lbl_parent_window_handle"); 26 | lblWindowPosition.Text = manager.GetString("lbl_window_position"); 27 | lblWindowSize.Text = manager.GetString("lbl_window_size"); 28 | lblExtendedFrameBounds.Text = manager.GetString("lbl_extended_frame_bounds"); 29 | lblInstance.Text = manager.GetString("lbl_instance"); 30 | lblProcessId.Text = manager.GetString("lbl_process_id"); 31 | lblThreadId.Text = manager.GetString("lbl_thread_id"); 32 | lblGwlStyle.Text = manager.GetString("lbl_gwl_style"); 33 | lblGclStyle.Text = manager.GetString("lbl_gcl_style"); 34 | lblGwlExStyle.Text = manager.GetString("lbl_gwl_exstyle"); 35 | lblWindowInfoExStyle.Text = manager.GetString("lbl_windowinfo_exstyle"); 36 | lblLwaAlpha.Text = manager.GetString("lbl_lwa_alpha"); 37 | lblLwaColorKey.Text = manager.GetString("lbl_lwa_colorkey"); 38 | lblGwlUserData.Text = manager.GetString("lbl_gwl_userdata"); 39 | lblDwlUser.Text = manager.GetString("lbl_dwl_user"); 40 | lblFullPath.Text = manager.GetString("lbl_full_path"); 41 | lblCommandLine.Text = manager.GetString("lbl_command_line"); 42 | lblStartedAt.Text = manager.GetString("lbl_started_at"); 43 | lblOwner.Text = manager.GetString("lbl_owner"); 44 | lblThreads.Text = manager.GetString("lbl_threads"); 45 | lblWorkingSetSize.Text = manager.GetString("lbl_working_set_size"); 46 | lblParent.Text = manager.GetString("lbl_parent"); 47 | lblPriority.Text = manager.GetString("lbl_priority"); 48 | lblHandles.Text = manager.GetString("lbl_handles"); 49 | lblVirtualSize.Text = manager.GetString("lbl_virtual_size"); 50 | lblProductName.Text = manager.GetString("lbl_product_name"); 51 | lblCopyright.Text = manager.GetString("lbl_copyright"); 52 | lblFileVersion.Text = manager.GetString("lbl_file_version"); 53 | lblProductVersion.Text = manager.GetString("lbl_product_version"); 54 | btnOk.Text = manager.GetString("information_btn_apply"); 55 | Text = manager.GetString("information"); 56 | 57 | var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone(); ; 58 | nfi.NumberGroupSeparator = ","; 59 | txtGetWindowText.Text = windowDetails.GetWindowText; 60 | txtWmGetText.Text = windowDetails.WM_GETTEXT; 61 | txtGetClassName.Text = windowDetails.GetClassName; 62 | txtRealGetWindowClass.Text = windowDetails.RealGetWindowClass; 63 | txtFontName.Text = windowDetails.FontName; 64 | txtWindowHandle.Text = $"0x{windowDetails.Handle.ToInt64():X}"; 65 | txtParentWindowHandle.Text = $"0x{windowDetails.ParentHandle.ToInt64():X}"; 66 | txtWindowPosition.Text = $"{windowDetails.Size.Left}, {windowDetails.Size.Top}"; 67 | txtWindowSize.Text = $"{windowDetails.Size.Width}x{windowDetails.Size.Height} ({windowDetails.ClientSize.Width}x{windowDetails.ClientSize.Height})"; 68 | txtInstance.Text = $"0x{windowDetails.Instance.ToInt64():X}"; 69 | txtProcessId.Text = $"0x{windowDetails.ProcessId:X} ({windowDetails.ProcessId})"; 70 | txtThreadId.Text = $"0x{windowDetails.ThreadId:X} ({windowDetails.ThreadId})"; 71 | txtExtendedFrameBounds.Text = $"{windowDetails.FrameBounds.Top} {windowDetails.FrameBounds.Right} {windowDetails.FrameBounds.Bottom} {windowDetails.FrameBounds.Left}"; 72 | txtGwlStyle.Text = $"0x{windowDetails.GWL_STYLE:X}"; 73 | txtGclStyle.Text = $"0x{windowDetails.GCL_STYLE:X}"; 74 | txtGwlExStyle.Text = $"0x{windowDetails.GWL_EXSTYLE:X}"; 75 | txtWindowInfoExStyle.Text = $"0x{windowDetails.WindowInfoExStyle:X}"; 76 | txtLwaAlpha.Text = windowDetails.LWA_ALPHA ? "+" : "-"; 77 | txtLwaColorKey.Text = windowDetails.LWA_COLORKEY ? "+" : "-"; 78 | txtGwlUserData.Text = $"0x{windowDetails.GWL_USERDATA:X}"; 79 | txtDwlUser.Text = $"0x{windowDetails.DWL_USER:X}"; 80 | txtFullPath.Text = windowDetails.FullPath; 81 | txtCommandLine.Text = windowDetails.CommandLine; 82 | txtStartedAt.Text = windowDetails.StartTime == null ? "" : windowDetails.StartTime.Value.ToString("dd.MM.yyyy HH:mm:ss"); 83 | txtOwner.Text = windowDetails.Owner; 84 | txtParent.Text = windowDetails.Parent; 85 | txtPriority.Text = windowDetails.Priority.ToString(); 86 | txtThreads.Text = windowDetails.ThreadCount.ToString(); 87 | txtHandles.Text = windowDetails.HandleCount.ToString(); 88 | txtWorkingSetSize.Text = ((decimal)windowDetails.WorkingSetSize).ToString("#,0", nfi); 89 | txtVirtualSize.Text = ((decimal)windowDetails.VirtualSize).ToString("#,0", nfi); 90 | txtProductName.Text = windowDetails.ProductName; 91 | txtCopyright.Text = windowDetails.Copyright; 92 | txtFileVersion.Text = windowDetails.FileVersion; 93 | txtProductVersion.Text = windowDetails.ProductVersion; 94 | } 95 | 96 | private void ButtonCloseClick(object sender, EventArgs e) => Close(); 97 | 98 | private void FormKeyDown(object sender, KeyEventArgs e) 99 | { 100 | if (e.KeyValue == 27) 101 | { 102 | Close(); 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /SmartContextMenu/Forms/SizeForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class SizeForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | /// Contains language strings. 30 | private void InitializeComponent() 31 | { 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeForm)); 33 | this.btnApply = new System.Windows.Forms.Button(); 34 | this.txtTop = new System.Windows.Forms.TextBox(); 35 | this.txtLeft = new System.Windows.Forms.TextBox(); 36 | this.lblTop = new System.Windows.Forms.Label(); 37 | this.lblLeft = new System.Windows.Forms.Label(); 38 | this.txtHeight = new System.Windows.Forms.TextBox(); 39 | this.txtWidth = new System.Windows.Forms.TextBox(); 40 | this.lblHeight = new System.Windows.Forms.Label(); 41 | this.lblWidth = new System.Windows.Forms.Label(); 42 | this.SuspendLayout(); 43 | // 44 | // btnApply 45 | // 46 | this.btnApply.Location = new System.Drawing.Point(321, 129); 47 | this.btnApply.Name = "btnApply"; 48 | this.btnApply.Size = new System.Drawing.Size(91, 26); 49 | this.btnApply.TabIndex = 8; 50 | this.btnApply.UseVisualStyleBackColor = true; 51 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 52 | // 53 | // txtTop 54 | // 55 | this.txtTop.Location = new System.Drawing.Point(216, 34); 56 | this.txtTop.Name = "txtTop"; 57 | this.txtTop.Size = new System.Drawing.Size(195, 20); 58 | this.txtTop.TabIndex = 3; 59 | // 60 | // txtLeft 61 | // 62 | this.txtLeft.Location = new System.Drawing.Point(12, 34); 63 | this.txtLeft.Name = "txtLeft"; 64 | this.txtLeft.Size = new System.Drawing.Size(195, 20); 65 | this.txtLeft.TabIndex = 1; 66 | // 67 | // lblTop 68 | // 69 | this.lblTop.AutoSize = true; 70 | this.lblTop.Location = new System.Drawing.Point(216, 18); 71 | this.lblTop.Name = "lblTop"; 72 | this.lblTop.Size = new System.Drawing.Size(0, 13); 73 | this.lblTop.TabIndex = 2; 74 | // 75 | // lblLeft 76 | // 77 | this.lblLeft.AutoSize = true; 78 | this.lblLeft.Location = new System.Drawing.Point(12, 18); 79 | this.lblLeft.Name = "lblLeft"; 80 | this.lblLeft.Size = new System.Drawing.Size(0, 13); 81 | this.lblLeft.TabIndex = 0; 82 | // 83 | // txtHeight 84 | // 85 | this.txtHeight.Location = new System.Drawing.Point(216, 90); 86 | this.txtHeight.Name = "txtHeight"; 87 | this.txtHeight.Size = new System.Drawing.Size(195, 20); 88 | this.txtHeight.TabIndex = 7; 89 | // 90 | // txtWidth 91 | // 92 | this.txtWidth.Location = new System.Drawing.Point(12, 90); 93 | this.txtWidth.Name = "txtWidth"; 94 | this.txtWidth.Size = new System.Drawing.Size(195, 20); 95 | this.txtWidth.TabIndex = 5; 96 | // 97 | // lblHeight 98 | // 99 | this.lblHeight.AutoSize = true; 100 | this.lblHeight.Location = new System.Drawing.Point(216, 74); 101 | this.lblHeight.Name = "lblHeight"; 102 | this.lblHeight.Size = new System.Drawing.Size(0, 13); 103 | this.lblHeight.TabIndex = 6; 104 | // 105 | // lblWidth 106 | // 107 | this.lblWidth.AutoSize = true; 108 | this.lblWidth.Location = new System.Drawing.Point(12, 74); 109 | this.lblWidth.Name = "lblWidth"; 110 | this.lblWidth.Size = new System.Drawing.Size(0, 13); 111 | this.lblWidth.TabIndex = 4; 112 | // 113 | // SizeForm 114 | // 115 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 116 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 117 | this.ClientSize = new System.Drawing.Size(424, 192); 118 | this.Controls.Add(this.txtTop); 119 | this.Controls.Add(this.txtLeft); 120 | this.Controls.Add(this.lblTop); 121 | this.Controls.Add(this.lblLeft); 122 | this.Controls.Add(this.txtHeight); 123 | this.Controls.Add(this.txtWidth); 124 | this.Controls.Add(this.lblHeight); 125 | this.Controls.Add(this.lblWidth); 126 | this.Controls.Add(this.btnApply); 127 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 128 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 129 | this.KeyPreview = true; 130 | this.MaximizeBox = false; 131 | this.MinimizeBox = false; 132 | this.Name = "SizeForm"; 133 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 134 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormKeyDown); 135 | this.ResumeLayout(false); 136 | this.PerformLayout(); 137 | 138 | } 139 | 140 | #endregion 141 | private System.Windows.Forms.Button btnApply; 142 | private System.Windows.Forms.TextBox txtTop; 143 | private System.Windows.Forms.TextBox txtLeft; 144 | private System.Windows.Forms.Label lblTop; 145 | private System.Windows.Forms.Label lblLeft; 146 | private System.Windows.Forms.TextBox txtHeight; 147 | private System.Windows.Forms.TextBox txtWidth; 148 | private System.Windows.Forms.Label lblHeight; 149 | private System.Windows.Forms.Label lblWidth; 150 | } 151 | } -------------------------------------------------------------------------------- /SmartContextMenu/Forms/HotkeysForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SmartContextMenu.Forms 2 | { 3 | partial class HotkeysForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HotkeysForm)); 32 | this.btnCancel = new System.Windows.Forms.Button(); 33 | this.btnApply = new System.Windows.Forms.Button(); 34 | this.cmbKey1 = new System.Windows.Forms.ComboBox(); 35 | this.cmbKey2 = new System.Windows.Forms.ComboBox(); 36 | this.cmbKey3 = new System.Windows.Forms.ComboBox(); 37 | this.lblKey1 = new System.Windows.Forms.Label(); 38 | this.lblKey2 = new System.Windows.Forms.Label(); 39 | this.lblKey3 = new System.Windows.Forms.Label(); 40 | this.SuspendLayout(); 41 | // 42 | // btnCancel 43 | // 44 | this.btnCancel.Location = new System.Drawing.Point(334, 93); 45 | this.btnCancel.Name = "btnCancel"; 46 | this.btnCancel.Size = new System.Drawing.Size(80, 35); 47 | this.btnCancel.TabIndex = 7; 48 | this.btnCancel.Text = "Cancel"; 49 | this.btnCancel.UseVisualStyleBackColor = true; 50 | this.btnCancel.Click += new System.EventHandler(this.ButtonCancelClick); 51 | // 52 | // btnApply 53 | // 54 | this.btnApply.Location = new System.Drawing.Point(245, 93); 55 | this.btnApply.Name = "btnApply"; 56 | this.btnApply.Size = new System.Drawing.Size(81, 35); 57 | this.btnApply.TabIndex = 6; 58 | this.btnApply.Text = "Ok"; 59 | this.btnApply.UseVisualStyleBackColor = true; 60 | this.btnApply.Click += new System.EventHandler(this.ButtonApplyClick); 61 | // 62 | // cmbKey1 63 | // 64 | this.cmbKey1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 65 | this.cmbKey1.FormattingEnabled = true; 66 | this.cmbKey1.Location = new System.Drawing.Point(16, 36); 67 | this.cmbKey1.Name = "cmbKey1"; 68 | this.cmbKey1.Size = new System.Drawing.Size(129, 21); 69 | this.cmbKey1.TabIndex = 1; 70 | // 71 | // cmbKey2 72 | // 73 | this.cmbKey2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 74 | this.cmbKey2.FormattingEnabled = true; 75 | this.cmbKey2.Location = new System.Drawing.Point(150, 36); 76 | this.cmbKey2.Name = "cmbKey2"; 77 | this.cmbKey2.Size = new System.Drawing.Size(129, 21); 78 | this.cmbKey2.TabIndex = 3; 79 | // 80 | // cmbKey3 81 | // 82 | this.cmbKey3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 83 | this.cmbKey3.FormattingEnabled = true; 84 | this.cmbKey3.Location = new System.Drawing.Point(285, 36); 85 | this.cmbKey3.Name = "cmbKey3"; 86 | this.cmbKey3.Size = new System.Drawing.Size(129, 21); 87 | this.cmbKey3.TabIndex = 5; 88 | // 89 | // lblKey1 90 | // 91 | this.lblKey1.AutoSize = true; 92 | this.lblKey1.Location = new System.Drawing.Point(13, 20); 93 | this.lblKey1.Name = "lblKey1"; 94 | this.lblKey1.Size = new System.Drawing.Size(34, 13); 95 | this.lblKey1.TabIndex = 0; 96 | this.lblKey1.Text = "Key 1"; 97 | // 98 | // lblKey2 99 | // 100 | this.lblKey2.AutoSize = true; 101 | this.lblKey2.Location = new System.Drawing.Point(147, 20); 102 | this.lblKey2.Name = "lblKey2"; 103 | this.lblKey2.Size = new System.Drawing.Size(34, 13); 104 | this.lblKey2.TabIndex = 2; 105 | this.lblKey2.Text = "Key 2"; 106 | // 107 | // lblKey3 108 | // 109 | this.lblKey3.AutoSize = true; 110 | this.lblKey3.Location = new System.Drawing.Point(282, 20); 111 | this.lblKey3.Name = "lblKey3"; 112 | this.lblKey3.Size = new System.Drawing.Size(34, 13); 113 | this.lblKey3.TabIndex = 4; 114 | this.lblKey3.Text = "Key 3"; 115 | // 116 | // HotkeysForm 117 | // 118 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 119 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 120 | this.ClientSize = new System.Drawing.Size(426, 158); 121 | this.Controls.Add(this.lblKey3); 122 | this.Controls.Add(this.lblKey2); 123 | this.Controls.Add(this.lblKey1); 124 | this.Controls.Add(this.cmbKey3); 125 | this.Controls.Add(this.cmbKey2); 126 | this.Controls.Add(this.cmbKey1); 127 | this.Controls.Add(this.btnCancel); 128 | this.Controls.Add(this.btnApply); 129 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 130 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 131 | this.KeyPreview = true; 132 | this.MaximizeBox = false; 133 | this.MinimizeBox = false; 134 | this.Name = "HotkeysForm"; 135 | this.ShowIcon = false; 136 | this.ShowInTaskbar = false; 137 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 138 | this.Text = "Hot Keys"; 139 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.KeyDownClick); 140 | this.ResumeLayout(false); 141 | this.PerformLayout(); 142 | 143 | } 144 | 145 | #endregion 146 | 147 | private System.Windows.Forms.Button btnCancel; 148 | private System.Windows.Forms.Button btnApply; 149 | private System.Windows.Forms.ComboBox cmbKey1; 150 | private System.Windows.Forms.ComboBox cmbKey2; 151 | private System.Windows.Forms.ComboBox cmbKey3; 152 | private System.Windows.Forms.Label lblKey1; 153 | private System.Windows.Forms.Label lblKey2; 154 | private System.Windows.Forms.Label lblKey3; 155 | } 156 | } --------------------------------------------------------------------------------