最近做的一个winform类型的项目中需要屏蔽系统热键,在网上搜索了一下,基本上都是调用api来进行hook操作,下面的代码就可以完成功能 using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Windows.Forms; namespace WAT.PMS { /// <summary> /// Description
1.使最小化按钮变灰:setwindowlong(handle,gwl_style,getwindowlong(handle,gwl_style) and not ws_minimizebox ); 2.使最大化按钮变灰:setwindowlong(handle,gwl_style,getwindowlong(handle,gwl_style) and not ws_maximizebox); 3. 关闭按钮变灰色 EnableMenuItem(GetSystemMen