Subclassing will catch the keystroke. Add this class to the project:
VB Code:
Imports System.Windows.Forms
Public Class Subclassing
Inherits System.Windows.Forms.NativeWindow
'Event Declaration. This event will be raised when any Message will be posted to the Control
Public Event CallBackProc(ByRef m As Message)
'Flag which indicates that either Event should be raised or not
Private m_Subclassed As Boolean = False
'During Creation of Object of this class, Pass the Handle of Control which you want to SubClass
Public Sub New(ByVal handle As IntPtr)
MyBase.AssignHandle(handle)
End Sub
'To Enable or Disable Receiving Messages
Public Property SubClass() As Boolean
Get
Return m_Subclassed
End Get
Set(ByVal Value As Boolean)
m_Subclassed = Value
End Set
End Property
Protected Overrides Sub WndProc(ByRef m As Message)
If m_Subclassed Then 'If Subclassing Enabled then RaiseEvent
RaiseEvent CallBackProc(m)
End If
'Setting the Msg member to 0 in the CallBackProc event means the code is handling the message
'Used mainly for overriding textbox context menu
If m.Msg > 0 Then MyBase.WndProc(m)
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class
Use it like this:
VB Code:
'In the form
Private WithEvents m_subclass As Subclassing
'In form's Load event:
m_subclass= New Subclassing(txtLDesc.Handle)
m_subclass.SubClass = True
'add this procedure to the form
Private Sub Callback(ByRef m As System.Windows.Forms.Message) Handles m_subclass.CallBackProc
'handle PrntScr key
If m.WParam.ToInt32 = 44 Then
End If
End Sub
Hope I got it all.