189 8069 5689

vb.net屏蔽组合键,vb中关闭程序窗口的组合键

vb.net中 如何屏蔽windows的ctrl+alt+del 热键

笨办法:

创新互联公司是专业的铁力网站建设公司,铁力接单;提供成都网站设计、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行铁力网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

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

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

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

.net的代码真木有写过。

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

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

VB代码我有 net木有。

VB.NET键盘Hook成功后拦截不了组合键

最简单的就是把属性改一下,效果跟无框的差不多。

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle

Me.ControlBox = False

Me.MaximizeBox = False

Me.Text = ""

至于hook的问题,它确实是比系统慢了一步得到消息,当前线程或全局的都一样,不过你可以先拦截Windows键或者Up键其中一键来阻拦组合键。

vb.net问题:如何屏蔽某键

只是文本框的话:

Private Const charSet As String = "abcdefghijklmnopqrstuvwxyz"

Private Sub textbox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles textbox1.KeyPress

If charSet.IndexOf(e.KeyChar) = -1 And e.KeyChar "" Then

e.Handled = True

End If

End Sub

这样只能输入charset 规定的字符

vb中怎么实现屏蔽Alt+Tap的组合键!

'点击窗体隐藏,按Alt

+

Tab回调窗体

Option

Explicit

Private

Declare

Function

GlobalAddAtom

Lib

"kernel32"

Alias

"GlobalAddAtomA"

(ByVal

lpString

_

As

String)

As

Integer

'为全局热键添加一个标识符

Private

Declare

Function

RegisterHotKey

Lib

"user32"

(ByVal

hWnd

As

Long,

ByVal

ID

As

Long,

_

ByVal

fsModifiers

As

Long,

ByVal

vk

As

Long)

As

Long

'hWnd:接收热键产生WM_HOTKEY消息的窗口句柄

'id:定义热键的标识符,GlobalAddAtom函数获得热键的标识符.

'MOD_ALT为Alt键,MOD_CONTROL为Ctrl键,MOD_SHIFT为Shift键,MOD_WIN为Windows按键。

'vk:定义热键的虚拟键码。

Private

Declare

Function

UnregisterHotKey

Lib

"user32"

(ByVal

hWnd

As

Long,

ByVal

ID

As

Long

_

)

As

Long

Private

Declare

Function

PeekMessage

Lib

"user32"

Alias

"PeekMessageA"

(lpMsg

As

Msg,

ByVal

_

hWnd

As

Long,

ByVal

wMsgFilterMin

As

Long,

ByVal

wMsgFilterMax

As

Long,

ByVal

_

wRemoveMsg

As

Long)

As

Long

Private

Declare

Function

WaitMessage

Lib

"user32"

()

As

Long

Private

Type

POINTAPI

x

As

Long

y

As

Long

End

Type

Private

Type

Msg

hWnd

As

Long

Message

As

Long

wParam

As

Long

lParam

As

Long

time

As

Long

pt

As

POINTAPI

End

Type

Const

MOD_ALT

=

H1

Const

PM_REMOVE

=

H1

Const

WM_HOTKEY

=

H312

Dim

HotKey_ID

As

Long

Private

HotKey_Flg

As

Boolean

Dim

Message

As

Msg

Private

Sub

Form_Click()

Me.Hide

HotKey_ID

=

GlobalAddAtom("Alt

+

Tab")

'RegisterHotKey

Me.hWnd,

HBFFF,

MOD_CONTROL

+

MOD_ALT,

vbKeyG

'注册

Ctrl+Alt+

G

为热键

RegisterHotKey

Me.hWnd,

HotKey_ID,

MOD_ALT,

9

'注册

Ctrl+Alt+

G

为热键

Me.Hide

HotKey_Flg

=

False

Do

While

Not

HotKey_Flg

WaitMessage

'等待消息

If

PeekMessage(Message,

Me.hWnd,

WM_HOTKEY,

WM_HOTKEY,

PM_REMOVE)

Then

'检查是否热键被按下

''''可以在此写入你要阻止的代码

Me.Show

End

If

DoEvents

'转让控制权,允许操作系统处理其他事件

Loop

End

Sub

Private

Sub

Form_Unload(Cancel

As

Integer)

'撤销热键的注册

HotKey_Flg

=

True

Call

UnregisterHotKey(Me.hWnd,

HotKey_ID)

End

Sub


网站题目:vb.net屏蔽组合键,vb中关闭程序窗口的组合键
文章出自:http://jkwzsj.com/article/hsopho.html

其他资讯