Beispiel #1
0
        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_GRAYED); // Disables controlbox
            USER32.RemoveMenu(hMenu, USER32.SC_CLOSE, USER32.MF_BYCOMMAND);  // Disables the exit menu
        }