重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

vb.net钩子资源的简单介绍

VB .net中如何调用底层键盘钩子或其他方法屏蔽全局所有按键

.net的代码真木有写过。

创新互联建站是一家集网站建设,龙州企业网站建设,龙州品牌网站建设,网站定制,龙州网站建设报价,网络营销,网络优化,龙州网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

VB 可以屏蔽 包括ctrl+alt+del在内的所有键盘按键消息

其实你只要后台截获按键的消息后,直接屏蔽掉就可以了。

VB代码我有 net木有。

vb.net编写的程序屏蔽系统热键

使用VB.net编写屏蔽热键的方法有很多中,比如说使用系统的API函数,也可以使用钩子来进行屏蔽.还有一种就是.net带的一种方法,首先来判断所按下去的键,然后再执行操作等事件.比如说:if (e.keycode==keys.D){e.handle=true}在keydown事件里面处理!这样就可以屏蔽了D键. 实例:if ((Control.ModifierKeys == Keys.Alt) (e.KeyCode == Keys.F4))

{

e.Handled = true;

}还有一种办法就是不通过屏蔽热键来实现,就是通过设置焦点.你可以把你程序窗口设置为主焦点,这样其他程序一般就无法在你的程序前面了.实现屏蔽的作用.至于任务管理器的话可以通过杀掉进程的办法做到.如下: Process[] p = Process.GetProcesses(); foreach (Process p1 in p)

{

try

{

if (p1.ProcessName.ToLower().Trim() == "taskmgr")//这里判断是任务管理器

{

p1.Kill();

return;

}

}

catch

{

return;

}

}}以上是使用C#编写的,稍微改下就可以了,在,NET里面都差不多!

vb中全局钩子

Syntax

HHOOK SetWindowsHookEx( int idHook,

HOOKPROC lpfn,

HINSTANCE hMod,

DWORD dwThreadId

);

Parameters

idHook

[in] Specifies the type of hook procedure to be installed. This parameter can be one of the following values.

WH_CALLWNDPROC

Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. For more information, see the CallWndProc hook procedure.

WH_CALLWNDPROCRET

Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. For more information, see the CallWndRetProc hook procedure.

WH_CBT

Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procedure.

WH_DEBUG

Installs a hook procedure useful for debugging other hook procedures. For more information, see the DebugProc hook procedure.

WH_FOREGROUNDIDLE

Installs a hook procedure that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks during idle time. For more information, see the ForegroundIdleProc hook procedure.

WH_GETMESSAGE

Installs a hook procedure that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procedure.

WH_JOURNALPLAYBACK

Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. For more information, see the JournalPlaybackProc hook procedure.

WH_JOURNALRECORD

Installs a hook procedure that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procedure.

WH_KEYBOARD

Installs a hook procedure that monitors keystroke messages. For more information, see the KeyboardProc hook procedure.

WH_KEYBOARD_LL

Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.

WH_MOUSE

Installs a hook procedure that monitors mouse messages. For more information, see the MouseProc hook procedure.

WH_MOUSE_LL

Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procedure.

WH_MSGFILTER

Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procedure.

WH_SHELL

Installs a hook procedure that receives notifications useful to shell applications. For more information, see the ShellProc hook procedure.

WH_SYSMSGFILTER

Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procedure monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procedure.

lpfn

[in] Pointer to the hook procedure. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a DLL. Otherwise, lpfn can point to a hook procedure in the code associated with the current process.

hMod

[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.

dwThreadId

[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.


标题名称:vb.net钩子资源的简单介绍
分享地址:http://cqcxhl.cn/article/hioosh.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP