以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]快捷键问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=75233)

--  作者:pcxjxjhkw
--  发布时间:2015/9/30 16:53:00
--  [求助]快捷键问题

根据大红袍分享的,设置了一些按钮的快捷键,但最近出现一个问题,当打开word或Execl软件时,总是弹出对话框,提示未到快捷键函数,并且要接连出现很多个对话框。求解


--  作者:大红袍
--  发布时间:2015/9/30 17:05:00
--  

 最多是不响应或者无效,不会弹出错误。

 

 例子发上来测试。


--  作者:大红袍
--  发布时间:2015/9/30 17:06:00
--  

如果不想触发,就在处理函数那里加入判断

 

If Windows.Forms.Form.ActiveForm is Nothing Then return


--  作者:pcxjxjhkw
--  发布时间:2015/9/30 17:36:00
--  

全局代码:

<DllImport("user32.dll", SetLastError := True)> _
Public Function RegisterHotKey(hWnd As IntPtr, id As Integer, fsModifiers As KeyModifiers, vk As Keys) As Boolean

End Function

<DllImport("user32.dll", SetLastError := True)> _
Public Function UnregisterHotKey(hWnd As IntPtr, id As Integer) As Boolean

End Function


<Flags> _
Public Enum KeyModifiers
None = 0
Alt = 1
Control = 2
Shift = 4
Windows = 8
End Enum


Public Class GlobalKeyDown
Inherits System.Windows.Forms.form

private shared obj As new GlobalKeyDown

private Sub New()
End Sub

Public Shared Function getInstance() As GlobalKeyDown
Return obj
End Function

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If System.Windows.Forms.Form.ActiveForm Is Nothing Then
   
Else
   
    Functions.Execute("处理快捷键", m)
    MyBase.WndProc(m)
   
End If
End Sub

End Class


--  作者:pcxjxjhkw
--  发布时间:2015/9/30 17:37:00
--  

当已关闭狐表时,也存在1楼情况。


--  作者:大红袍
--  发布时间:2015/9/30 20:58:00
--  
关闭狐表的时候,把快捷键取消绑定。
--  作者:pcxjxjhkw
--  发布时间:2015/9/30 21:18:00
--  
如何取消?
--  作者:大红袍
--  发布时间:2015/10/4 12:28:00
--  
看原来例子