DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
New Global Input Hook
// description of your code here
Public Class MyAppFilter
Implements IMessageFilter
Const WM_KEYDOWN As Integer = &H100
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Const WM_MBUTTONDOWN = &H207
Const WM_MBUTTONUP = &H208
Const WM_MBUTTONDBLCLK = &H209
Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean _
Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
Select Case m.Msg
Case WM_KEYDOWN
ApplicationGlobal.mSecurityTimer.ResetTimer()
Case WM_MBUTTONDOWN
ApplicationGlobal.mSecurityTimer.ResetTimer()
Case WM_RBUTTONDOWN
ApplicationGlobal.mSecurityTimer.ResetTimer()
Case WM_LBUTTONDOWN
ApplicationGlobal.mSecurityTimer.ResetTimer()
Case Else
End Select
'Select Case m.WParam.ToInt32'
'Case Keys.F2'
End Function
End Class
Then in the main form load. To handle the input and stop it going to the control return true. (check this)
Application.AddMessageFilter(New MyAppFilter)




