如何屏蔽Ctrl+Alt+Del win2000和xp 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是想屏蔽任务管理器?在一个timer里不停的判断当前进程里是否有"taskmgr.exe",有则kill re,SetWindowsHookEx,捕获WH_GETMESSAGE,CALLBACK里不return CallNextHookEx而返回1就是忽略该消息。自己判断一下。 关于键盘钩子我现在还没明白,曾经发帖子问没结果,也见过发同样帖子的人,都没解决.....多数只是告诉你,这是键盘钩子,hook........不过告诉你个不幸的消息,ctrl + alt + del 和 ctrl + shift + ESC 是一样的.....还有,简单的禁用任务管理器可以使用修改注册表..... 曾经发帖别人告诉我的,不过我没有用好,你可以借鉴一下注:别人的代码,非本人////C# codeusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;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;namespace 钩子{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { SetHook(); } internal enum HookType { //msgfilter = -1, //journalrecord = 0, //journalplayback = 1, Keyboard = 2, //getmessage = 3, //callwndproc = 4, //cbt = 5, //sysmsgfilter = 6, //mouse = 7, //hardware = 8, //debug = 9, //shell = 10, //foregroundidle = 11, //callwndprocret = 12, //keyboardll = 13, }; IntPtr _nextHookPtr; //记录hook编号 [DllImport("kernel32.dll")] static extern int GetCurrentThreadId(); //取得当前线程编号的API [DllImport("user32.dll")] internal extern static void UnhookWindowsHookEx(IntPtr handle); //取消hook的api [DllImport("user32.dll")] internal extern static IntPtr SetWindowsHookEx(int idHook, [MarshalAs(UnmanagedType.FunctionPtr)] HookProc lpfn, IntPtr hinstance, int threadID); //设置hook的api [DllImport("user32.dll")] internal extern static IntPtr CallNextHookEx(IntPtr handle, int code, IntPtr wparam, IntPtr lparam); internal delegate IntPtr HookProc(int code, IntPtr wparam, IntPtr lparam); IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam) { if (code < 0) return CallNextHookEx(_nextHookPtr, code, wparam, lparam); if (wparam.ToInt32() == 98 && wparam.ToInt32() == 66) { this.textBox1.Text = "a"; return (IntPtr)1; } else { return IntPtr.Zero; } } public void SetHook() { if (_nextHookPtr != IntPtr.Zero) return; HookProc myhookProc = new HookProc(MyHookProc); _nextHookPtr = SetWindowsHookEx((int)HookType.Keyboard, myhookProc, IntPtr.Zero, GetCurrentThreadId()); } public void UnHook() { if (_nextHookPtr != IntPtr.Zero) { UnhookWindowsHookEx(_nextHookPtr); _nextHookPtr = IntPtr.Zero; } } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { UnHook(); } }} 是不是那个 “namespace 钩子” 不能有中文呢?? C#Winform 主从窗体 Datatable 中的元素可以是数组吗? 求一个注册码算法 数据库的连接 大哥大姐大叔大声们来帮小弟一把拉~~~~~~~~~~~~~~~ 写出一个函数将字符串STR="a,123;b,456;c,789"存入HashMap中。 请教:使用checkedListBox生成查询语句!! 状态栏的显示 谁有项目做啊? 刚做好的winform.net程序有关薪资及人事档案管理方面[简单],征求大家的建议 WINFORM 部署时,如何修改配置文件中的数据库连接字符串 求教:需要返回多个参数的处理技巧
在一个timer里不停的判断当前进程里是否有"taskmgr.exe",有则kill
自己判断一下。
也见过发同样帖子的人,都没解决.....
多数只是告诉你,这是键盘钩子,hook........
不过告诉你个不幸的消息,ctrl + alt + del 和 ctrl + shift + ESC 是一样的.....
还有,简单的禁用任务管理器可以使用修改注册表.....
注:别人的代码,非本人////C# codeusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
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;namespace 钩子
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
SetHook();
} internal enum HookType
{
//msgfilter = -1,
//journalrecord = 0,
//journalplayback = 1, Keyboard = 2, //getmessage = 3,
//callwndproc = 4,
//cbt = 5,
//sysmsgfilter = 6,
//mouse = 7,
//hardware = 8,
//debug = 9,
//shell = 10,
//foregroundidle = 11,
//callwndprocret = 12,
//keyboardll = 13, };
IntPtr _nextHookPtr; //记录hook编号
[DllImport("kernel32.dll")]
static extern int GetCurrentThreadId(); //取得当前线程编号的API [DllImport("user32.dll")]
internal extern static void UnhookWindowsHookEx(IntPtr handle); //取消hook的api [DllImport("user32.dll")]
internal extern static IntPtr SetWindowsHookEx(int idHook, [MarshalAs(UnmanagedType.FunctionPtr)] HookProc lpfn, IntPtr hinstance, int threadID); //设置hook的api [DllImport("user32.dll")]
internal extern static IntPtr CallNextHookEx(IntPtr handle, int code, IntPtr wparam, IntPtr lparam); internal delegate IntPtr HookProc(int code, IntPtr wparam, IntPtr lparam);
IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam)
{
if (code < 0)
return CallNextHookEx(_nextHookPtr, code, wparam, lparam);
if (wparam.ToInt32() == 98 && wparam.ToInt32() == 66)
{
this.textBox1.Text = "a";
return (IntPtr)1;
}
else
{
return IntPtr.Zero;
}
} public void SetHook()
{
if (_nextHookPtr != IntPtr.Zero)
return; HookProc myhookProc = new HookProc(MyHookProc);
_nextHookPtr = SetWindowsHookEx((int)HookType.Keyboard, myhookProc, IntPtr.Zero, GetCurrentThreadId());
}
public void UnHook()
{
if (_nextHookPtr != IntPtr.Zero)
{
UnhookWindowsHookEx(_nextHookPtr);
_nextHookPtr = IntPtr.Zero;
}
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
UnHook();
}
}
}
是不是那个 “namespace 钩子” 不能有中文呢??