NativeMethods.cs
上传用户:dzysfj
上传日期:2021-09-14
资源大小:118k
文件大小:1k
源码类别:

菜单

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. namespace CSharpWin
  6. {
  7.     internal class NativeMethods
  8.     {
  9.         public const int WM_SYSCOMMAND = 0x0112;
  10.         public static readonly IntPtr TRUE = new IntPtr(1);
  11.         [DllImport("user32.dll", SetLastError = true)]
  12.         public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
  13.         [DllImport("user32.dll", SetLastError = true)]
  14.         public static extern bool InsertMenu(
  15.             IntPtr hMenu,
  16.             int wPosition,
  17.             int wFlags,
  18.             int wIDNewItem,
  19.             string lpNewItem);
  20.         [DllImport("user32.dll",SetLastError = true)]
  21.         public static extern bool AppendMenu(
  22.             IntPtr hMenu, int wFlags, int wIDNewItem, string lpNewItem);
  23.     }
  24. }