C#中怎么屏蔽组合键?

来源:百度知道 编辑:UC知道 时间:2024/09/26 13:48:29
想做个程序貌似像一个屏幕锁,请各位帮帮忙怎么实现?我的想法是把系统的组合键屏蔽了就可以了(Alt+F4,Ctrl+Alt+Delete,Alt+Tab等等)!
有别的想法的也可以说说啊!
Ctrl+Alt+Delete 还是不行!

貌似只能通过hook,

参考
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;
using System.Diagnostics;
using Microsoft.Win32;

namespace WindowsApplication1
{
public partial class Form2 : Form
{
//委托
public delegate int HookProc(int nCode, int wParam, IntPtr lParam);
static int hHook = 0;
public const int WH_KEYBOARD_LL = 13;

//LowLevel键盘截获,如果是WH_KEYBOARD=2,并不能对系统键盘截取,Acrobat Reader会在你截取之前获得键盘。
HookProc KeyBoardHookProcedure;

//键盘Hook结构函数
[StructLayout(LayoutKind.Sequential)]
public class KeyBoardHookStruct
{
public int vkCode;