案例代码片段:

    public partial class Form1 : Form
    {
        [DllImport("USER32.dll")]
        public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags);

        [DllImport("USER32.dll")]
        public static extern int GetSystemMenu(int hWnd, int bRevert);

        const int MF_REMOVE = 0x1000;
        const int SC_CLOSE = 0xF060;

        public Form1()
        {
            //do something

            int hMenu = GetSystemMenu(this.Handle.ToInt32(), 0);
            RemoveMenu(hMenu, SC_CLOSE, MF_REMOVE);

            //do something
        } 
    }

 

相关文章:

  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-11-16
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2021-09-27
  • 2021-05-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案