资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb点虐 禁用alt vbnet tabcontrol

vb如何屏蔽alt+空格键

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960下面是屏蔽 ALT+F4的例子分二步:1、建立一个模块,然后复制下面代码Option ExplicitPrivate Declare Function GetKeyState Lib "User32" _(ByVal nVirtKey As Long) As IntegerPublic Declare Function SetWindowsHookEx Lib "User32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As LongPublic Declare Function UnhookWindowsHookEx Lib "User32" (ByVal hHook As Long) As LongPublic Declare Function CallNextHookEx Lib "User32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As LongPublic Declare Sub CopyMemory Lib "a

创新互联建站是一家专业提供昌江企业网站建设,专注与成都网站设计、做网站H5场景定制、小程序制作等业务。10年已为昌江众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。

href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Yduym4m1ckrHR1uHmsrAfk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnW0LPjDYPHTznWbdn1mLrjb3r0"

target="_blank"

class="baidu-highlight"kernel32/a" Alias "RtlMoveMemory" (lpvDest As Any, ByVal lpvSource As Long, ByVal cbCopy As Long)Public Type KEYMSGSvKey As LongsKey As Longflag As Longtime As LongEnd TypePublic Const WH_KEYBOARD_LL = 13Public Const VK_LWIN = H5BPublic Const VK_RWIN = H5CPublic Const HC_ACTION = 0Public Const HC_SYSMODALOFF = 5Public Const HC_SYSMODALON = 4Public Const a

href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Yduym4m1ckrHR1uHmsrAfk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnW0LPjDYPHTznWbdn1mLrjb3r0"

target="_blank"

class="baidu-highlight"WM_KEYDOWN/a= H100Public Const WM_KEYUP = H101Public Const a

href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Yduym4m1ckrHR1uHmsrAfk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnW0LPjDYPHTznWbdn1mLrjb3r0"

target="_blank"

class="baidu-highlight"WM_SYSKEYDOWN/a = H104Public Const WM_SYSKEYUP = H105 Public P As KEYMSGSPublic lHook As Long Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As LongDim fEatKeystroke As Boolean If (nCode = HC_ACTION) ThenIf wParam = a

href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Yduym4m1ckrHR1uHmsrAfk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnW0LPjDYPHTznWbdn1mLrjb3r0"

target="_blank"

class="baidu-highlight"WM_KEYDOWN/aOr wParam = a

href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Yduym4m1ckrHR1uHmsrAfk0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnW0LPjDYPHTznWbdn1mLrjb3r0"

target="_blank"

class="baidu-highlight"WM_SYSKEYDOWN/a Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP ThenCopyMemory P, ByVal lParam, Len(P)Select CaseP.vKeyCase vbKeyF4 If (GetKeyState(vbKeyMenu) And H8000) 0 Then '如果按了Alt+F4键fEatKeystroke = True '就吃了End IfEnd SelectEnd IfEnd IfIf fEatKeystroke ThenLowLevelKeyboardProc = -1ElseLowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)End IfEnd Function 2、在Form中程序调用如下: Private Sub Form_Load()lHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)'设置键盘勾子End Sub Private Sub Form_Unload(Cancel As Integer)UnhookWindowsHookEx lHook''取消键盘勾子End Sub

vb点虐 编写的程序屏蔽系统热键

使用VB点虐 编写屏蔽热键的方法有很多中,比如说使用系统的API函数,也可以使用钩子来进行屏蔽.还有一种就是点虐 带的一种方法,首先来判断所按下去的键,然后再执行操作等事件.比如说: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点虐 中 如何屏蔽windows的ctrl+alt+del 热键

笨办法:

加个菜单控件,设置个空选项

再把这个菜单选项的快捷键设置成ctrl+alt+del

VB中如何禁止使用ALT+Tab键切换

使用Hook(钩子函数)即可截获ALT+TAB

Windows的钩子函数分两种,一种是全局的,一种是线程的。全局的钩子函数可以捕获任何应用程序的消息,但必须是标准的DLL才能实现,VB做不了。VB可以实现线程的,就是当前应用程序的消息,这对鼠标消息的捕捉有影响。

SetWindowsHookEx定义如下:

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

idHook是钩子类型,如WH_KEYBOARD捕捉键盘消息,而WH_MOUSE捕捉鼠标消息。hmod用于全局钩子,VB要实现钩子,必须设为0。dwThreadId用于线程钩子VB中可以设置为App.ThreadID。lpfn为钩子函数,在VB中可以使用AddressOf获得钩子函数的地址。这个函数因为钩子类型不同而有所不同。如键盘钩子为:

Public Function KeyboardProc(ByVal nCode As Long, _

ByVal wParam As Long, _

ByVal lParam As Long) As Long

如果Code不为0,钩子函数必须调用CallNextHookEx,将消息传递给下面的钩子。wParam和lParam不是按键。

可以到这里看看:

BEAR-BEN的QQ:453628001


文章题目:vb点虐 禁用alt vbnet tabcontrol
文章出自:http://cdkjz.cn/article/ddgpjii.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220