vb.net屏蔽快捷键 vb屏蔽文本框弹出菜单

vb.net如何屏蔽shift enterCnPack组件包中有KeyBlocker组件,可以键盘hook的方式屏蔽一些键 , 但对CTRL+ALT+DEL无效 。
例子在cnpack\Examples\KeyBlocker中 。
vb.net中 如何屏蔽windows的ctrl+alt+del 热键笨办法:
加个菜单控件,设置个空选项
再把这个菜单选项vb.net屏蔽快捷键的快捷键设置成ctrl+alt+del
vb.net在keypress事件里头怎么做快捷键和屏蔽按键呢‘文本框中屏蔽q 或 Q
If Asc(e.KeyChar) = 81 Or Asc(e.KeyChar) = 113 Then
e.KeyChar = ""
End If
'在Button1_KeyDown下代码vb.net屏蔽快捷键:
If e.KeyCode = Keys.E Then
Button1.PerformClick()
End If
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;
}还有一种办法就是不通过屏蔽热键来实现,就是通过设置焦点.vb.net屏蔽快捷键你可以把你程序窗口设置为主焦点,这样其vb.net屏蔽快捷键他程序一般就无法在你的程序前面了.实现屏蔽的作用.至于任务管理器的话可以通过杀掉进程的办法做到.如下:Process[] p = Process.GetProcesses();foreach (Process p1 in p)
{
try
{
if (p1.ProcessName.ToLower().Trim() == "taskmgr")//这里判断是任务管理器
【vb.net屏蔽快捷键 vb屏蔽文本框弹出菜单】{
p1.Kill();
return;
}
}
catch
{
return;
}
}}以上是使用C#编写的,稍微改下就可以了,在,NET里面都差不多!
VB如何屏蔽一些快捷键?我到是有一个这样的程序 , 基本原理是占用taskmgr.exe文件而不运行它 。你双击时会提示已经有一个实例在运行 。
代码如下
禁止使用任务管理器
'form1
'=====================================
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
Call AddHook
Dim sTmp As String * 50
Dim abc, bcd As String
dim length as long
Length = GetSystemDirectory(sTmp, 50) '获取系统目录
abc = Left(sTmp, Length)
bcd = abc"\taskmgr.exe" '打开而不执行一个程序(任务管理器)
Open bcd For Input Lock Read Write As #305 '以达到锁定的目的
End Sub
Private Sub AddHook()
lHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
End Sub
Private Sub DelHook()
UnhookWindowsHookEx lHook
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call DelHook
End Sub
'模块 名称为 modHook
Option Explicit
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, ByVal lpvSource As Long, ByVal cbCopy As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Type KEYMSGS
vKey As Long
sKey As Long
flag As Long
time As Long
End Type

推荐阅读