protected override void ProcessRecord() { if (hWnd == IntPtr.Zero) { hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; } IntPtr hMenu = USER32.GetSystemMenu(hWnd, false); USER32.EnableMenuItem(hMenu, USER32.SC_CLOSE, USER32.MF_ENABLED); //Enables controlbox USER32.AppendMenu(hMenu, USER32.MenuFlags.MF_STRING, USER32.SC_CLOSE, "Exit"); // Enables the exit menu }