WinForms 中怎样禁用ALT+F4快捷键
来源:百度知道 编辑:UC知道 时间:2024/07/02 10:24:20
(都说具体点,最好弄点源码来,我是新鸟,谢谢各位了)
我用的是全局键盘钩子。这个程序可以屏蔽win和alt+f4但是不能屏蔽ctrl+alt+del。我一直在找屏蔽ctrl+alt+del的方法希望会的人指点一下。用了
form_load事件和Form1_FormClosing事件
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace WindowsApplication10
{
public partial class Form1 : Form
{
// 安装钩子
[DllImport("user32.dll")]
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
// 卸载钩子
[DllImport("user32.dll")]
public static extern bool UnhookWindowsHookEx(int idHook);
// 继续下一个钩子
[DllImport("user32.dll")]
public static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr l